sam452
Posts: 9
Joined: Sat Apr 26, 2014 8:55 pm

Downgrade wifi to b protocol

Sat Feb 20, 2016 9:11 pm

I have a working wifi connection using a Panda-type dongle on my Raspberry Pi A+ running wheezy. However, while running a python program I find that it occasionally drops its connection. Even writing in functions to detect the drop and attempt to reconnect the connection it still fails for hours at a time.

It's been suggested that because of my application, a weather station connecting to my wifi router through leafy trees, that I should set my wpa_supplicant to use the 'b' protocol since it is more robust and my needs for speed are not that pressing. I've Googled here and around to find how to modify my supplicant file for that possiblity. It appears that I'm using the wrong terms to return the help I need. What should be my search terms to find how to do this?

As you can see from the output of ifconfig, power management is OFF.

Code: Select all

wlan0     IEEE 802.11bgn  ESSID:"Zoomer"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.412 GHz  Access Point: E8:DE:27:B3:   
          Bit Rate:150 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=100/100  Signal level=100/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

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

Re: Downgrade wifi to b protocol

Sat Feb 20, 2016 9:34 pm

What is a 'Panda-type dongle'?
Switching off power management in /etc/network/interfaces is not always enough.
Some dongles need settings in the driver config file.
Exactly what chipset does your dongle have (output of lsusb could be useful)

sam452
Posts: 9
Joined: Sat Apr 26, 2014 8:55 pm

Re: Downgrade wifi to b protocol

Sat Feb 20, 2016 10:25 pm

Happy to. Thanks for reading, sam

Code: Select all

Bus 001 Device 002: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

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

Re: Downgrade wifi to b protocol

Sat Feb 20, 2016 10:42 pm

Forgot to ask you for the output of

Code: Select all

lsmod
to see what driver is loaded for this dongle

sam452
Posts: 9
Joined: Sat Apr 26, 2014 8:55 pm

Re: Downgrade wifi to b protocol

Sat Feb 20, 2016 10:54 pm

Yes, I had thought it was 8192cu but in this output it's not used?

Code: Select all

i2c_dev                 6730  0 
snd_bcm2835            22317  0 
snd_soc_wm8804_i2c      1866  0 
snd_soc_tas5713         5866  0 
snd_soc_pcm512x_i2c     2570  0 
snd_soc_wm8804          8413  1 snd_soc_wm8804_i2c
snd_soc_pcm512x        18073  1 snd_soc_pcm512x_i2c
regmap_i2c              3346  3 snd_soc_pcm512x_i2c,snd_soc_wm8804_i2c,snd_soc_tas5713
snd_soc_bcm2708_i2s     7566  0 
regmap_mmio             3556  1 snd_soc_bcm2708_i2s
snd_soc_core          168338  4 snd_soc_pcm512x,snd_soc_wm8804,snd_soc_tas5713,snd_soc_bcm2708_i2s
snd_compress            8809  1 snd_soc_core
snd_pcm_dmaengine       5778  1 snd_soc_core
snd_pcm                92581  5 snd_bcm2835,snd_soc_pcm512x,snd_soc_wm8804,snd_soc_core,snd_pcm_dmaengine
snd_seq                61957  0 
snd_seq_device          5130  1 snd_seq
snd_timer              23454  2 snd_pcm,snd_seq
8192cu                569532  0 
snd                    68161  7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
spi_bcm2708             6041  0 
i2c_bcm2708             6252  0

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

Re: Downgrade wifi to b protocol

Sat Feb 20, 2016 11:07 pm

Try the solution mentioned in this post: viewtopic.php?f=28&t=93489&p=651785#p651635

sam452
Posts: 9
Joined: Sat Apr 26, 2014 8:55 pm

Re: Downgrade wifi to b protocol

Sun Feb 21, 2016 1:19 am

Yes, what is the solution in that link? Was it to hardcode the config into /etc/network/interfaces?

If so, as before, my connection runs fine but for some reason it fails.

I've done a comparison of lsmod, I think, to see if there was a difference when it was up and when it was down but diff could detect no change in the output.

Is there a special driver for this device? This happens across other known-good Realtek wifi devices, thx, sam

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

Re: Downgrade wifi to b protocol

Sun Feb 21, 2016 8:07 am

sam452 wrote:Yes, what is the solution in that link? Was it to hardcode the config into /etc/network/interfaces?
No, it switches off power management, so the dongle should not go into sleep mode.
But it could be that a sleeping dongle is not the problem in your case.

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

Re: Downgrade wifi to b protocol

Sun Feb 21, 2016 8:14 am

sam452 wrote:Yes, what is the solution in that link? Was it to hardcode the config into /etc/network/interfaces?

If so, as before, my connection runs fine but for some reason it fails.

I've done a comparison of lsmod, I think, to see if there was a difference when it was up and when it was down but diff could detect no change in the output.

Is there a special driver for this device? This happens across other known-good Realtek wifi devices, thx, sam
It states create the file /etc/modprobe.d/8192cu.conf. You can do that using

Code: Select all

sudo nano /etc/modprobe.d/8192u.conf
and add lines

Code: Select all

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
As far as the content of lsmod when your wifi is down you won't see any difference to when it is working. The wifi driver is installed but the wifi adapter has probably gone to sleep because it is idle, which is why you cannot get a connection. The file above stops this happening.

Drivers for Realtek chips do not use the Power Management:off you see in the output from iwconfig but the file above.

If your wifi turns off or drops the connection it is possible to turn it back on using a script that checks if the connection has gone down, like this one https://github.com/dweeber/WiFi_Check/b ... WiFi_Check. There are many alternatives providing a similar function mentioned in the forum.



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

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

sam452
Posts: 9
Joined: Sat Apr 26, 2014 8:55 pm

Re: Downgrade wifi to b protocol

Sun Feb 21, 2016 1:31 pm

Yes, thank you for clarifying what I should be looking for in that link.

I had hoped that this line in my /etc/modprobe.d/8192u.conf would do the trick:

Code: Select all

options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
As for my function to check the wlan connection, it's on line 806 of

https://github.com/sam452/WeatherPi/blo ... atherPi.py

Since this isn't working, I'm thinking of what to do next or try forcing the wifi encoding down to "b" once I figure out how to do that?, sam

Return to “Advanced users”