Hi,
I've now discovered that wlan scanning at one minute intervals also happens on the inbuilt adapter.
If you have 'iw' installed try running 'iw event' and look at the output.
What subsystem is starting those scans? How can they be stopped?
Someone must know...
Cheers,
Glenn
Re: More on wifi scanning
Lots of info is available on "iw" by doing a google search on "iw linux" but right off, two I found were https://wireless.wiki.kernel.org/en/use ... ntation/iw and https://linuxcommando.blogspot.com/2013 ... twork.html. From a cursory look at both sources, I did not find anything to clarify that scanning is occurring continuously as you imply, unless the command is invoked. Presumably, a "CTRL-c" stoppng iw event stops the scanning. If you or another have info to the contrary, I'd like to see it. I was unable to find "iw" running by invoking and searching for iw but when I invoked it showed up. Htop must be added to Raspbian with
Code: Select all
iw event
Code: Select all
htop
Code: Select all
iw event
Code: Select all
sudo apt-get install htop
Re: More on wifi scanning
iw wlan1 event will display all events on the interface. It's not initiating the scans. Something else is.
Similarly if you start wpa_cli you will see scan events occurring regularly.
I don't think it's wpa_supplicant that's initiating the scans.
Perhaps it's the driver?
Driving me nuts!
Cheers
Glenn
Similarly if you start wpa_cli you will see scan events occurring regularly.
I don't think it's wpa_supplicant that's initiating the scans.
Perhaps it's the driver?
Driving me nuts!
Cheers
Glenn
Re: More on wifi scanning
If you have a full installation of Raspbian (with the UI), it's likely that the scans are coming from lxpanel to update the Wi-Fi networks in the background.
If you don't need lxpanel, you can comment out the below line in /etc/xdg/lxsession/LXDE-pi/autostart:
If you don't need lxpanel, you can comment out the below line in /etc/xdg/lxsession/LXDE-pi/autostart:
Code: Select all
@lxpanel --profile LXDE-pi
Re: More on wifi scanning
I had similar problems, and eventually tracked down three independent sources for the WiFi scans: lxpanels dhcpcd-ui (app level), wpa-supplicant (mid-level), and the Broadcom driver (low level).
lxpanels dhcpcd-ui applet: lxpanels dhcpcd-ui, when WiFi is associated, by default automatically performs the once-per-minute background scans. You can disable that by entering a new line in file ~/.config/lxpanel/LXDE-pi/panels/panel. Look for a Plugin entry of type=dhcpcdui. Here's what I put in (comments are my own and totally optional ... but I always forget why I do things!). The only line you really need to add is "BgScan=0" ... Note that the capitalization of "BgScan" must be exact:
wpa-supplicant: This also, by default, performs background scans if nothing else does, which happened every ~70 seconds once I disabled the lxpanels scans. The file to modify is /etc/wpa_supplicant/wpa_supplicant.conf. Disable background scans via line bgscan="" (empty double-quotes). If written outside of a network block, it should apply globally to all networks. I'm paranoid, and entered it twice, once at a global level, and once within the block for my "AC2YD - QTH" network, which is the latency-sensitive one; I also set that at a higher priority for association than the other network via priority=2. I also entered two other global entries, so if scans did occur, they would be as limited as possible ... freq_list=2412 5180 limits a scan to just 2 WiFi channels, i.e. the channels on which my 2 networks operate. scan_cur_freq=1 looked as if it might keep scans from going off-channel when associated, but I'm not sure ... for info, search for "Example wpa_supplicant configuration file" on internet. My wpa_supplicant.conf looks like this:
Driver: The driver, or perhaps the firmware inside the Broadcom chip, will also automatically scan by default, if nothing else launches a scan. IIRC, this happened every ~130 seconds, once I disabled wpa_supplicant scans. To disable this, I had to create a new file /etc/modprobe.d/brcmfmac.conf, and add a single line to disable roaming (and therefore disable the scans required to perform roaming):
YMMV ... Good luck!
lxpanels dhcpcd-ui applet: lxpanels dhcpcd-ui, when WiFi is associated, by default automatically performs the once-per-minute background scans. You can disable that by entering a new line in file ~/.config/lxpanel/LXDE-pi/panels/panel. Look for a Plugin entry of type=dhcpcdui. Here's what I put in (comments are my own and totally optional ... but I always forget why I do things!). The only line you really need to add is "BgScan=0" ... Note that the capitalization of "BgScan" must be exact:
Code: Select all
Plugin {
type=dhcpcdui
Config {
# The following entry eliminates 1-minute-periodic wifi scans
# originating from dhcpcd-ui (lxpanel app that lets you select
# the AP you want; click on wifi symbol at top of desktop).
# Scans disable wifi comm intermittently causing delays!
# NOTE: THIS DOES NOT SET ANY WPA_SUPPLICANT VALUES!
# dhcpcd-ui calls wpa_cli utility directly, using SCAN command
BgScan=0
}
}
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
freq_list=2412 5180
scan_cur_freq=1
bgscan=""
network={
ssid="123weak"
psk="xxxxxxxxxxxxxx"
key_mgmt=WPA-PSK
disabled=1
}
network={
ssid="AC2YD - QTH"
psk="xxxxxxxxxxxxxx"
key_mgmt=WPA-PSK
bgscan=""
priority=2
}
Code: Select all
options brcmfmac roamoff=1
Re: More on wifi scanning
Thanks for posting. This looks like very useful information which I'll try out now.bmcahill wrote: ↑Sat Apr 03, 2021 3:33 amI had similar problems, and eventually tracked down three independent sources for the WiFi scans: lxpanels dhcpcd-ui (app level), wpa-supplicant (mid-level), and the Broadcom driver (low level).
lxpanels dhcpcd-ui applet: lxpanels dhcpcd-ui, when WiFi is associated, by default automatically performs the once-per-minute background scans. You can disable that by entering a new line in file ~/.config/lxpanel/LXDE-pi/panels/panel. Look for a Plugin entry of type=dhcpcdui. Here's what I put in (comments are my own and totally optional ... but I always forget why I do things!). The only line you really need to add is "BgScan=0" ... Note that the capitalization of "BgScan" must be exact:
wpa-supplicant: This also, by default, performs background scans if nothing else does, which happened every ~70 seconds once I disabled the lxpanels scans. The file to modify is /etc/wpa_supplicant/wpa_supplicant.conf. Disable background scans via line bgscan="" (empty double-quotes). If written outside of a network block, it should apply globally to all networks. I'm paranoid, and entered it twice, once at a global level, and once within the block for my "AC2YD - QTH" network, which is the latency-sensitive one; I also set that at a higher priority for association than the other network via priority=2. I also entered two other global entries, so if scans did occur, they would be as limited as possible ... freq_list=2412 5180 limits a scan to just 2 WiFi channels, i.e. the channels on which my 2 networks operate. scan_cur_freq=1 looked as if it might keep scans from going off-channel when associated, but I'm not sure ... for info, search for "Example wpa_supplicant configuration file" on internet. My wpa_supplicant.conf looks like this:Code: Select all
Plugin { type=dhcpcdui Config { # The following entry eliminates 1-minute-periodic wifi scans # originating from dhcpcd-ui (lxpanel app that lets you select # the AP you want; click on wifi symbol at top of desktop). # Scans disable wifi comm intermittently causing delays! # NOTE: THIS DOES NOT SET ANY WPA_SUPPLICANT VALUES! # dhcpcd-ui calls wpa_cli utility directly, using SCAN command BgScan=0 } }
Driver: The driver, or perhaps the firmware inside the Broadcom chip, will also automatically scan by default, if nothing else launches a scan. IIRC, this happened every ~130 seconds, once I disabled wpa_supplicant scans. To disable this, I had to create a new file /etc/modprobe.d/brcmfmac.conf, and add a single line to disable roaming (and therefore disable the scans required to perform roaming):Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US freq_list=2412 5180 scan_cur_freq=1 bgscan="" network={ ssid="123weak" psk="xxxxxxxxxxxxxx" key_mgmt=WPA-PSK disabled=1 } network={ ssid="AC2YD - QTH" psk="xxxxxxxxxxxxxx" key_mgmt=WPA-PSK bgscan="" priority=2 }
YMMV ... Good luck!Code: Select all
options brcmfmac roamoff=1