Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 8:43 am

Hi all,

As the subject states, is there any way to disable the onboard wifi and use a wifi dongle instead? I'm using the Pi in an area that has weak wifi and I have found that using a wifi dongle increases the range. The utility I have written is showing the IP address of the Pi on screen when it's booted and I have found that if I have both wlans running I can get the 169.254.... address which is leading people to believe that is has connected to a wifi network when it has not..

Is there any way configure the wlan so that it only shows an IP if it is connected to a network?

The application is using PyGame and the code used to display the IP is

Code: Select all

	# Write the IP address
    SCREENBOTTOM.fill(BGCOLOR)
    ipaddr = check_output(['hostname', '-I'])
    IP_ADDR = fontIP.render(ipaddr, 1, IP_COLOR)
    SCREENBOTTOM.blit(IP_ADDR, (880, 60))
Thanks
A

Edit: I should mention that I have tried using
config.txt
blacklist
and ifdown in crontab
these methods either do not disable wifi or disable both onboard and dongle

DirkS
Posts: 10867
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 8:50 am

Ant232 wrote:As the subject states, is there any way to disable the onboard wifi and use a wifi dongle instead?
What did you add to config.txt?
AFAIK adding

Code: Select all

dtoverlay=pi3-disable-wifi
should disable onboard wifi
See /boot/overlays/README for more info.

Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Re: Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 9:05 am

Hi Dirk,

Thanks for the reply. The
dtoverlay=pi3-disable-wifi
method has no effect. If I do ifconfig it shows wlan0 and wlan1.

I might has to do an update/upgrade. I have been trying to avoid this because everything is stable on the pi at the mo and I was concerned that the update might break something. I'll image the card - update - and try your method again and see is that works..

Thanks
A

MrEngman
Posts: 4140
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 12:28 pm

Ant232 wrote:Hi Dirk,

Thanks for the reply. The
dtoverlay=pi3-disable-wifi
method has no effect. If I do ifconfig it shows wlan0 and wlan1.

I might has to do an update/upgrade. I have been trying to avoid this because everything is stable on the pi at the mo and I was concerned that the update might break something. I'll image the card - update - and try your method again and see is that works..

Thanks
A
Add the line blacklist brcmfmac to file /etc/modprobe.d/raspi-blacklist.conf or one of the other conf files in directory /etc/modprobe.d.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Re: Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 2:33 pm

Thanks for the replies.
I think I may have been looking at this the wrong way. What I am actually trying to do is stop the wlan1 interface from getting it's 169.254.. address when there is not wifi signal. It seems that once the 169.254... address is assigned the wlan1 does not pick up the router even if it is in range again.
I have a pygame script that shows the current IP. What I would like it to do is show the IP when there is a valid address from a router and for it to be blank when no address but pick up an address if back in range of a router.

Any ideas?

Thanks

Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Re: Disable onboard wifi and use dongle, any ideas?

Sat May 20, 2017 3:12 pm

In
/etc/dhcp/dhclient.conf
there are parameters for how long until the 169 address is assigned and how often the interface should retry to find a valid connection, these should sort the problem for me..

Thanks again for the previous replies.
A.

moelarrycheese
Posts: 3
Joined: Sun May 21, 2017 3:29 am

Re: Disable onboard wifi and use dongle, any ideas?

Sun May 21, 2017 3:59 am

Copy the following to the config.txt file. anywhere works but at the end is easier to find and edit. you can then enable or disable both onboard bluetooth and wireless. i disable both on mine and use dongles. the following has onboard bluetooth enabled and onboard wifi disabled.

# Disable/Enable On-Board WIFI-Bluetooth
#wifi
blacklist brcmfmac
blacklist brcmutil
#bt
#blacklist btbcm
#blacklist hci_uart

Ant232
Posts: 115
Joined: Thu Jul 12, 2012 9:34 pm

Re: Disable onboard wifi and use dongle, any ideas?

Tue May 23, 2017 11:49 am

Hi,

Thanks for the blacklist suggestion. I tried it but when I do ifconfig I can still see wlan0 and wlan1

I thought I had the problem solved with the DHCP settings in the above post but that crafty 169.254.. is still finding ways to annoy me :(

Thanks
A

Martin Frezman
Posts: 1009
Joined: Mon Oct 31, 2016 10:05 am

Re: Disable onboard wifi and use dongle, any ideas?

Tue May 23, 2017 12:08 pm

Ant232 wrote: I thought I had the problem solved with the DHCP settings in the above post but that crafty 169.254.. is still finding ways to annoy me.
I may not be following this completely, but if your goal is to not display the 169.254... address, can't you just put code in to check for it (and do the appropriate if it sees it)? I.e., something like:

Code: Select all

IF WeHaveAnIPAddr;
   IF IPAddr not match 169.254.*.*
       DisplayIt
In case you're wondering if that is legit, it is. The 169.254 thing is defined in standards; it is not just arbitrary or random.
If this post appears in the wrong forums category, my apologies.

runboy93
Posts: 352
Joined: Tue Feb 28, 2017 1:17 pm
Location: Finland

Re: Disable onboard wifi and use dongle, any ideas?

Mon Jun 12, 2017 10:31 am

I've used both overlays and blacklist option, usb dongle works fine.

"sudo nano /boot/config.txt"

dtoverlay=pi3-disable-bt
dtoverlay=pi3-disable-wifi

"sudo systemctl disable hciuart"

"sudo nano /etc/modprobe.d/raspi-blacklist.conf"

#wifi
blacklist brcmfmac
blacklist brcmutil
#bt
blacklist btbcm
blacklist hci_uart

Return to “General discussion”