elfdude
Posts: 3
Joined: Sun May 19, 2013 5:31 pm

Edimax EW-7811Un Disconnect issue

Sun May 19, 2013 6:22 pm

Recently purchased a pi-b and an Edimax EW-7811Un. I have successfully gotten it to (mostly) work with the following config...

/etc/network/interfaces
----------------------------
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp

/etc/wpa_supplicant/wpa_supplicant.conf
------------------------------------------------

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="Holonet"
psk="the password"
proto=WPA
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
}

With this config I can connect to the Internet from the pi very reliably. And I can also connect to it from other devices on the network (its main purpose in life is being a file server) for awhile. But after sometime it stops responding to pings/smbclient accesses/ssh connects/etc. If I issue a ping from the pi (via connected keyboard) then all is well again. What is the best way to determine if this is an issue with how the pi/edimax are configured or possibly an issue with my Linksys WRT160N router (WPA Personal, mixed?)
Last edited by elfdude on Mon May 20, 2013 12:03 pm, edited 1 time in total.

pjc123
Posts: 921
Joined: Thu Mar 29, 2012 3:37 pm

Re: Edimax EW-7811Un Disconnect issue

Sun May 19, 2013 8:47 pm

Your symptom sounds like your wifi dongle is going into power management mode. Add the following to the /etc/network/interfaces file, then either reboot or stop/start the network interface for it to take effect:

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
wireless-power off

Then issuing the "iwconfig" command will tell you what state power management is in. Here is an example output:

root@raspbmc:/home/pi# iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"yourapssid" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.462 GHz Access Point: 68:7F:74:09:31:62
Bit Rate:72 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=97/100 Signal level=74/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
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

elfdude
Posts: 3
Joined: Sun May 19, 2013 5:31 pm

Re: Edimax EW-7811Un Disconnect issue

Mon May 20, 2013 12:01 pm

Excellent. That has resolved my issue. Thank you very much!

I hate to punish a successful answer with another question, but is there an online reference page/site for the various settings that Debian/Linux make available in the interfaces file that you would recommend? If not, no biggie as this has gotten me working.

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

Re: Edimax EW-7811Un Disconnect issue

Mon May 20, 2013 1:05 pm

Weird.

I have the latest Raspbian 2013-02-09 updated with rpi-update with an EW-7811Un. Using command iwconfig is currently showing Power Management:off without modifying /etc/network/interfaces. In fact this is something new I was not aware of and I assume wireless-power off actually means disable power management and not turn off wifi power - well maybe, its not obvious. Care to enlighten us pjc123?

What image are you using - command uname -a will show the details. I'd like to see if I can reproduce your problem. I'm curious why you are having this problem and I'm not. I'd like to try and find a reason why - other than the setting in /etc/network/interfaces.

As for your question as a start you could try command man interfaces - man == manual I think. Can be used to get basic info on most commands. e.g. man command-name.


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

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

pjc123
Posts: 921
Joined: Thu Mar 29, 2012 3:37 pm

Re: Edimax EW-7811Un Disconnect issue

Mon May 20, 2013 1:17 pm

elfdude wrote:Excellent. That has resolved my issue. Thank you very much!

I hate to punish a successful answer with another question, but is there an online reference page/site for the various settings that Debian/Linux make available in the interfaces file that you would recommend? If not, no biggie as this has gotten me working.
You know, I never did come across a detailed reference for the /etc/network/interfaces file. I just did a lot of googling, reading the online manuals and reading various of forums to learn how it works. However, the wpa_supplicant.conf file setup is very well documented on the pi in /usr/share/doc/wpa_supplicant with a slew of examples.

Most things are documented right on your pi using the online manual. If you already don't know how to use the online manuals, type "man man" and have a read. When you are reading a topic with the man command, take particular note on the displayed page to pointers to other areas in the pi's directory or on the web for more detailed information on the topic, as well as looking at the "SEE ALSO" section which points to related commands. Very useful tools for finding things quick in the online manual are "man -k <keyword>" or its variants, or using the apropos command.
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

pjc123
Posts: 921
Joined: Thu Mar 29, 2012 3:37 pm

Re: Edimax EW-7811Un Disconnect issue

Mon May 20, 2013 1:43 pm

MrEngman wrote:Weird.
MrEngman
Yes, "wireless-power off" means disable power management, and I agree...misleading name (I guess they left the word management off to keep the command short). I suspect the reason why it is either necessary or not necessary to add the wireless-power off command using the same type of device has to do with the wifi device hardware version number, operating system type and/or version, or chipset driver version. My wifi dongle (TP-Link) power management was always off by default on every Debian based version going all the way back to Squeeze, so I did not have to specifically turn it off. I have also seen where some wifi dongles just ignore the wireless-power command, and in other cases it does not work in the /etc/network/interfaces file, but works from the command line.
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

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

Re: Edimax EW-7811Un Disconnect issue

Mon May 20, 2013 11:20 pm

Looked through various SD cards with old images, 3.1.9+, 3.2.27+ and 3.6.11+ and the very latest 3.6.11+ from today and like you power management is off in all of them.

All images are Debian based like yours - squeeze and wheezy - and use the Realtek drivers from Realtek's web site. Before the driver was included in the main code I used to compile the driver and put it on dropbox for people to use along with an installation script. Seemed to be amazingly popular probably because the rtl8188cus based wifi dongles were relatively cheap. I didn't do much with it after the driver got included in the code with the GUI to initialise it, but have noticed a few people trying to use it recently so eventually updated it to use wpa_cli to initialise wpa_supplicant.conf without having to run the GUI.

There are a load of parameters for the driver stored in /sys/module/8192cu, including for power management I guess, so It may be possible that they may be being configured differently for some images but it would suprise me if they were as I would expect them to be configured by the driver when it is loaded and the driver source would need editing to change them.

rtw_power_mgnt is I presume the parameter for determining power management and after a reboot this is always set to 1 even if it is edited and set to 0. Setting it to 0 and restarting the wifi, ifdown/ifup, without rebooting it stays set to 0 and iwconfig always show power management off.

Also tried modifying /etc/network/interfaces by adding wireless-power on and still power management remains off even after a reboot.

Trying manually I get

Code: Select all

$ sudo iwconfig wlan0 power on
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Operation not permitted.
whatever that means, using command with or without sudo. This is the same for the EW-7811Un and a Micronet SP907NS also using the rtl8188cus.

Just tried a Netgear WNA1100 (Atheros AR9271) and I can use the manual command to turn power management on/off. Defaults to off on start up.

An Edimax EW-7622UMn using the 8192su driver, I think, gives the following

Code: Select all

$ sudo iwconfig wlan0 power on
Error for wireless request "Set Power Management" (8B2C) :
    SET failed on device wlan0 ; Function not implemented.
This makes a bit more sense.

Anyway as I said - weird - something else to add to my to do list.


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

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

pjc123
Posts: 921
Joined: Thu Mar 29, 2012 3:37 pm

Re: Edimax EW-7811Un Disconnect issue

Tue May 21, 2013 12:00 am

MrEngman wrote:Looked through various SD cards with old images, 3.1.9+, 3.2.27+ and 3.6.11+ and the very latest 3.6.11+ from today and like you power management is off in all of them.
MrEngman
Yes, strange indeed. The reason I knew right away what the problem was with the OP's setup was because "pinging" out from inside the pi made it work again, so it was obvious that the dongle was in low power mode and needed to be awaken.

Here is another person posting today with what appears to be the same exact problem with the Edimax, same fix but applied in a different way:

http://www.raspberrypi.org/phpBB3/viewt ... 28&t=44409


I ordered my pi on the first day it was introduced, and based on the popularity of the Edimax at the time I ordered yet another clone, the AirLink AWLL5088. Your script made it a breeze to install and I pretty much followed that entire long thread. However, it wasn't getting very good range, so since then I switched to a TP-Link TL-WN722N which has fantastic reception and range. That also required a bunch of steps to install, but the drivers are now included in recent distributions.
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

elfdude
Posts: 3
Joined: Sun May 19, 2013 5:31 pm

Re: Edimax EW-7811Un Disconnect issue

Tue May 21, 2013 2:09 am

I ran the uname -a and got...

Linux raspberrypi 3.6.11+ #452 PREEMPT Fri May 17 14:25:40 BST 2013 armv6l GNU/Linux

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

Re: Edimax EW-7811Un Disconnect issue

Tue May 21, 2013 9:56 am

elfdude wrote:I ran the uname -a and got...

Linux raspberrypi 3.6.11+ #452 PREEMPT Fri May 17 14:25:40 BST 2013 armv6l GNU/Linux
Same as I have, the very latest and greatest Raspbian, and my EW-7811Un has no problems. Stays powered on all the time. Really odd problem.

Have you loaded any wifi management software or tried using any wifi management tools?

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

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

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

Re: Edimax EW-7811Un Disconnect issue

Tue May 21, 2013 6:59 pm

pjc123 wrote:Here is another person posting today with what appears to be the same exact problem with the Edimax, same fix but applied in a different way:

http://www.raspberrypi.org/phpBB3/viewt ... 28&t=44409
Hmmm. Occidentalis uses 3.1.9+ and has udev setup to use 70-persistent-net.rules by default so how has it been altered to make it use the new rule mentioned - wlan0.rules? Also I notice mention of wicd. I've seen that mentioned in the past causing issues if installed along side other network management tools.

And something else rather odd. The output from syslog appears to refer to wlan1 not wlan0. Well, wlan1 appears a couple of times and no sign of wlan0.

Running my image of Occidentalis0.2 has no problems with a single wifi adapter. And once again iwconfig reports power management is off. I have the raw image with no updates and the only setup required is to edit /etc/network/interfaces to set the ssid and password.

However, changing the wifi adapter, particularly hot-plugging, even after /etc/network/interfaces has been updated to take care of a second adapter which would be wlan1 because of udev can create all sorts of problems. In fact raises an issue I found when changing from squeeze to wheezy. Squeeze was fine but Wheezy had a real problem. Nobody seemed interested at the time and I never found what caused the problem or a solution. There is a serious bug somewhere but what and where I never figured out. Is this why using udev for the wifi was removed from later images? I wouldn't be suprised if it was. Now with the current setup trying to use more than one wifi adapter with a Pi is very much hit and miss as far as I'm concerned. Especially because devices are not assigned persistent names.

Someone trying to be too clever somewhere?

Hot-plugged in a wifi adapter that hasn't been used with my Occidentalis image before /etc/network/interfaces has been configured for wlan1 and visually it looks as though it might be working, the LED is constantly flashing looks pretty much as though there is a connection - but it is not connected. /etc/udev/rules.d/70-persistent-net.rules has set up a new rule for wlan1 but ifconfig shows wlan0 but with no inet addr. So ifconfig thinks wlan0 is plugged in, udev says the adapter is wlan1. As the LED is constantly flashing it's like something is trying to bring up wlan0, but it doesn't connect because udev says it is wlan1. That's what it looks like to me.

Have to do the following to get wlan1 up initially. Set up /etc/network/interfaces for wlan1, sudo ifdown --force wlan0 to force ifconfig or whatever to close wlan0, then sudo ifup wlan1 to get wlan1 to come up. Or just reboot which I find inconvenient. Once set up, to change wifi using hotplug, it is often necessary to sudo ifdown wlan? before removing the adaptor or the adapter being plugged in will not come up and connect.

More details on the issue here. It's a really strange problem and having been reminded about it I really must take another look at it. Squeeze had no problem at all with hotplugging different wifi adapters, Wheezy on the other hand is a totally different kettle of fish and is really broken as far as hotplugging wifi adapters is concerned if udev is set to monitor wifi and you use more than one wifi adapter. And without udev there are certain configurations that no longer work.

Not sure hotplugging would be an issue these days though as the Pi Mk2 generally resets if a wifi adapter is plugged directly into it while powered on so hotplugging is a no no these days. An issue with the Pi but hardware this time. How it got released for production with this problem is beyond belief. However, it need not be though as there is a very simple way round the problem - use a USB extension cable to connect the wifi to the Pi. Plug the wifi into one end of the cable and the other end into the Pi. You can then hotplug the wifi without problems. Well I do and I've never had the Pi reset since using the extension cable and I power it from a USB port on my Windows laptop. So nothing special about the PSU and no powered hubs in sight.


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

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

Return to “Beginners”