Page 1 of 2

Edimax Wifi adapter seems to go to sleep if not used (solved

Posted: Sun Nov 24, 2013 4:30 pm
by AforAlex
Hi,

Still trying to get to the bottom of this one, but it appears that the WiFi adapter keeps on 'going to sleep' if its not getting any traffic.

Typical behaviour would be switch on the Pi, using the Edimax wifi adapter, no lan connection. All is well and I SSH onto the Pi, it then seems that as long as I am doing something in the SSH screen then everything is fine, but as soon as I stop doing anything on the PI and come back then it takes about 30 seconds for the system to start back up again.

Just to be clear, the SSH connection hasn't been dropped, the pi is still active and functional (if I log into it directly then its still functioning), but in the SSH session whatever I type doesn't appear ..... until about 10-30 seconds later it all springs back to life.

I'm using a original model B Pi, with latest updates applied.

Any thoughts on what could be going on here would be very much appreciated, seems to me that there is some kind of wifi/Edimax power saving that's kicking in .... could this be right??

Thanks in advanced

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Sun Nov 24, 2013 5:47 pm
by MrEngman
Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command

Code: Select all

sudo nano /etc/modprobe.d/8192cu.conf
and add the following lines

Code: Select all

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Sun Nov 24, 2013 7:04 pm
by AforAlex
Hi many thanks, yes its the Edimax EW-7811Un, never in a million years would I have thought of looking there and creating a file with those settings so much appreciated

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Thu Jan 02, 2014 8:04 pm
by texy
MrEngman wrote:Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command

Code: Select all

sudo nano /etc/modprobe.d/8192cu.conf
and add the following lines

Code: Select all

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman
Many thanks for this MrEngman. I have had this same problem for some time now and couldn't work out what was wrong. The above change has also fixed the problem for me.
The question is why it has suddenly started to be a problem? I,ve been using the Edimax wifi dongle for over 18 months now and its been very reliable. Something has clearly changed in the code. Although this is a full workaround, I,d rather it not happen in the first place.

Texy

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Thu Jan 02, 2014 8:34 pm
by MrEngman
Hi Texy,

Glad to be some help. I came across this suggestion in a post on the forum quite a long time ago.

I've no idea why it works, other than it interacts directly with the driver, but there appear to be some oddities regarding so called power management. Command iwconfig always shows power management is off regardless. But the 8192cu driver for the EW7811Un is compiled by default with minimum power management enabled, and appears unaffected by the general power management setting, so could drop power after some time but shouldn't turn off, and this is even when power management is reportedly turned off. It could be the distance to the AP may come in to it and when power is reduced the connection could be lost. Just a guess though.

I can run my Pi's without the 8192cu.conf file and I generally don't have a problem, although I normally have the 8192cu.conf file set up regardless. Similarly for devices using the 8188eu driver a 8188eu.conf file with similar contents will keep that one working as well.


MrEngman

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Sat Feb 08, 2014 11:52 pm
by jhamlin
Thanks so much for this fix!!

Working great for me now too.

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Mon Feb 17, 2014 9:34 pm
by dl2mic
Hi All,

many thanks for all the suggestions to solve this issue.
Unfortunately none of them solved my problem.

My Router is powered off for some time.
The Pi looses its Wifi connection. I think that the Pi Edimax driver falls into deep sleep if the Router is off for too long. The same could be if the Link is not stable for a longer time.

Power On the Router restarts all devices but the Pi.

Ping does not work as there is no Router and later the Device is obviously in deep sleep.

I solved this my way:

Code: Select all

#!/bin/bash
# check if a wlan0 if exists
if echo `/sbin/ifconfig` | grep -q $1; then
#check if there is IP Address
  if echo `/sbin/ifconfig $1` | grep -q "inet Adresse"; then
    exit 0
  fi
  /sbin/modprobe -r 8192cu
fi
/sbin/modprobe 8192cu
exit 0
$1 is wlan0

This script is executed every Minute by cronjob as root.

Maybe there are better ways. But it works for me.

A.

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Thu Jun 19, 2014 5:17 pm
by czhanacek
Thank you so much MrEngman! I've been having the same problem for a while now, and this is such a necessary step for having a hard-to-access Pi like mine. Now I don't have to run outside and reboot the thing to tweak it.

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Fri Jul 11, 2014 3:34 pm
by Hasse.Nielsen
Hi,
I'm having the same kind of problems with a Pi model B and a Edimax micro.
My Pi is mounted on the roof and its pretty annoying to have to flick the power once or twice a day.

Would anyone like to join forces on development of a preconfigured disk image that focus on stability and unattended remote placement?

Kind regards
Hasse

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Fri Sep 12, 2014 1:47 am
by whowantspi
Thanks for posting this. I just found this fix after fighting this problem for many months. Somewhere along the way some code or driver changed because all four of my wireless adapters worked fine for six months before I started having problems. Thanks again.
MrEngman wrote:Try this. Make a file 8192cu.conf in directory /etc/modprobe.d/ with the command

Code: Select all

sudo nano /etc/modprobe.d/8192cu.conf
and add the following lines

Code: Select all

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I'm assuming you are using the Edimax EW-7811Un


MrEngman

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Tue Oct 07, 2014 5:37 pm
by vjoco
Upgrading to Raspberry Pi B+ model, using a new Raspbian image, I began to experience instabilities in wlan0 functionality. I try the 8192cu.conf method. I will post here the results!

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Sat Oct 11, 2014 5:31 am
by vjoco
IT IS WORKING!

sudo nano /etc/modprobe.d/8192cu.conf

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Fri Oct 24, 2014 3:02 pm
by RolfBly
Here is some documentation about the power settings.

Adafruit have a slightly different solution, with rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1.

(Edit 27-10). This also works, But! The documentation says:
In PS mode, you can turn on or turn off the USB autosuspend functionality
. From this, I deduce that enusbss=1 is ignored if rtw_power_mgnt=0, since this disables PS mode. In other words, if you want to just disable power save mode, all you'd need to do is

Code: Select all

# Disable power management
options 8192cu rtw_power_mgnt=0

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Fri Oct 24, 2014 3:25 pm
by DougieLawson
There's four parms listed in the document you cite.

Code: Select all

rtw_power_mgnt=0|1|2
  • 0 == disable power saving
  • 1 == power saving on, minPS
  • 2 == power saving on, maxPS

Code: Select all

rtw_enusbss=0|1
  • 0 == disable auto suspend
  • 1 == enable auto suspend

Code: Select all

rtw_hwpwrp_detect=0|1
  • 0 == disable HW power pin detection
  • 1 == enable HW power pin detection

Code: Select all

rtw_ips_mode=0|1
  • 0 == low power, IPS_NORMAL
  • 1 == higher power, IPS_LEVEL2
The conventional wisdom, because we're running our RPis as server systems not clients, is to set rtw_power_mgnt=0 and rtw_enusbss=0 to prevent the dongle going into power saving and to ignore the other two parms because they don't make any difference. If the server goes into power saving we'd need a process to wake it up. That's different from a client system where interaction from a keyboard user will trigger a request to wake up and associate the dongle.

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Tue Nov 18, 2014 4:14 pm
by ds00424
@DougieLawson
Good Q.
I do see in the doc:
"In PS mode, you can turn on or turn off the USB autosuspend functionality by adding the following parameter"

Could it be that if NOT in PS mode that autosuspend is off - no matter what the setting?
Have you tried "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0 rtw_ips_mode=1"
And if so, with what success? Curious minds what to know :-)

I have several remote RPis and once in a while the wifi drops on one or another - making me go visit it. Maybe it's lonely, but I would rather not have to make the drive.

On my dev system I was having ssh drop offs after about 30 sec idle. Sometimes it would drop the ssh and sometimes it would take 10 seconds to show characters. The original suggested fix looks like it has made this problem go away (so far after a few mins).

Just tried "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0 rtw_ips_mode=1" and it also seems to have fixed my ssh dropoffs.

I am going to see how it works in the field over a few weeks...
Will report back.

Re: Edimax Wifi adapter seems to go to sleep if not used

Posted: Sun Nov 23, 2014 4:42 pm
by EricFlagstaffAZ
Many thanks for providing the power management fix using the update to the 8192cu.conf file.
I can confirm that it solved my problem with both the Edimax EW-7811Un as well as the NETIS WF2123 Wireless USB Adapters.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Sat Dec 20, 2014 1:18 am
by ds00424
I have had this fix applied to 9 remote RPis. Prior to this fix, over the past year, various ones have dropped of their local wifi. Not sure why -- perhaps weaker wifi? Usually at the rate of one or two a month. With this fix I have only had two drop offs in the last month and each of those can be attributed to service provider failures. So far so good (knock on wood). Thanks again.

Mac to Pi SSH connection dropped -- fixed

Posted: Mon Dec 22, 2014 4:16 am
by hdtodd
I've been struggling with intermittent loss of SSH connections from Mac to Pi for a couple of months, but persistent in the last week or two. I'll add my thanks to MrEngman to those of other posters. To my surprise, this was the solution. Others reporting similar problems found that their problems were caused by conflicting IP addresses, short timeouts on DHCP leases, or other factors -- I tinkered with a bunch of them to no avail. This modprobe addition fixed it.

A contributing confusion was that this was intermittent, but occurrences increased substantially recently. That was because I had earlier been using another brand of WiFi dongle, besides one Edimax on a rarely-used Pi, and I recently added a second Edimax when I added yet another Pi, and I've been using primarily that new Edimax. Didn't connect the dots 'til I saw MrEngman's post.

I'm titling the subject of this post in a way that I looked for solutions in hopes that it'll help someone else find their solution more quickly.

THANKS!

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Mon Dec 22, 2014 12:33 pm
by Loonhaunt
Ditto,

This was more of a problem with the B+ than previous versions.

DB

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Sat Feb 07, 2015 9:45 am
by AlessandroFerri
hello everyone,
I find the instructions very interesting. I solved a lot of doubts. I am left with a very big doubt.
I have two wifi doungle: the first is a Edimax EW-7811Un, the transmission data rate can go up to 150Mbps, and a D-Link DWA-131 Wireless speeds of up to 150 Mbps (Transmit) and 300 Mbps (Receive) according to manufacturers' specifications. I use my raspberry with shairport on my home network, with other devices Airplay. When I check the connection from my mac I see that the raspberry is connected from 58Mb/s to 72Mb/s with Edimax and 144Mb/s with the D-Link. Is there anyone who can tell me why the connection is half?
Should be about 150Mb/s for the edimax and about 300Mb/s for the D.Link.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Sat Feb 07, 2015 1:11 pm
by pluggy
I long since learnt to accept that a cheap computer like the Pi is slow and the USB interface has long had issues (not so much these days, but they are still there). I just live with the lacklustre Wifi performance. Take it from me, stuff works a lot better now than it did 3 years ago. If you want top notch performance, buy a computer that costs a lot more than a Pi.

I've asked (to no avail) that this patch be incorporated into standard Raspbian, a couple of kilobytes in one file is neither here nor there with all the bloat in recent Raspdians.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Sat Feb 07, 2015 1:21 pm
by AlessandroFerri
Thank You,
but this does not explain whether if it is a problem of Pi, or if it is a problem of port usb wifi setup.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Sat Feb 07, 2015 1:45 pm
by pluggy
Its the Pi's limited USB interface. The SOC used in the Pi was never envisaged to be used as a USB host. My pi can't move stuff over wifi halfway near as fast as my laptop.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Thu Mar 12, 2015 10:59 am
by spatieman
A friend has the new model B++ (quad core) ,he has the same isue when we tested it yesterday.
think he wil be happy with this.

Re: Edimax Wifi adapter seems to go to sleep if not used (so

Posted: Tue Jun 16, 2015 4:01 am
by wbjapcow
I had this problem with my EDUP EP-N8508GS WiFi dongle as well. Not surprising I guess - it has a similar chipset.

The other suggestions did help.

Had to create this file

/etc/modprobe.d/8192cu.conf

and edit as suggested in this post

Wondering if this turns of power management on other things I might rather keep on.

-wbjapcow