Switching back and forth between wireless adapters is pretty straight forward in the Desktop environment of a Raspberry Pi, but what if you need the Pi to stay connected to your ALFA adapter and it keeps connecting to the onboard adapter? It can be infuriating when your system does not have a display or remote access. In this article we will share a couple techniques to help ease this annoyance.
Technique 1 (Temporarily disabling - Will not stay disabled if the system reboots):
- Open Terminal
- Run the following command to establish which wlan you will need to disable:
sudo iwconfig
***If you are unsure which one it is unplug any of the additional wireless adapters***
- In this case we want to disable wlan0 so we will run the following command, however if you are trying to disable wlan1, wlan2, etc you will replace wlan0 in the following command with the wlan you would like to disable:
sudo ifconfig wlan0 down - If your wireless interface looks like this and you don't have any additional wireless adapters plugged in, that means the command worked.
- If you want to re-enable that wlan run the following command replacing wlan0 with the one you want to re-enable:
sudo ifconfig wlan0 down
Technique 2 (A more permanent solution - Will stay disabled upon system reboot):
- Open Terminal
***It is advised, but not necessary, to unplug any additional wireless adapters before continuing*** -
Run the following command to enter the blacklist for Raspberry Pi:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
It will probably be empty and look something like this.
-
Next copy and paste the 2 following lines in:
blacklist brcmfmac
blacklist brcmutil
- Next press (Ctrl-O) to intiate the write out process, then press (Enter) to continue.
- After that press (Ctrl-X) to exit the blacklist.
- At this point your onboard Raspberry Pi wireless adapter should be disabled.
- You can test to see if it worked by rebooting your system.
To re-enable the onboard wireless is pretty much the same exact process but in reverse.
- Open Terminal
-
Run the following command to enter the blacklist for Raspberry Pi:
sudo nano /etc/modprobe.d/raspi-blacklist.conf - Delete the 2 following lines from the blacklist:
blacklist brcmfmac
blacklist brcmutil - Next press (Ctrl-O) to initiate the write out process, then press (Enter) to continue.
- After that press (Ctrl-X) to exit the blacklist.
At this point the onboard wireless card should be re-enabled.