EW-7811Un 802.11n Wireless Adapter connection dropouts

Hi all,

I have noticed that the wifi adapter which came with my emonpi (and RPi 2B) seems to be quite unreliable. I have found others in the raspberry pi world who have solved the problem Edimax Wifi adapter seems to go to sleep if not used (solved - Raspberry Pi Forums and others who have adapted the solution for the latest 4.9 kernel Poor wireless performance on 4.9.* kernels · Issue #1866 · raspberrypi/linux · GitHub

In summary, the adapter seems to have a poor power management implementation which causes it to disconnect regularly. Turning off the power management solves the problem 100% for me. There are two drivers for this adapter in the latest 4.9 kernel, only one of which has the parameters which allow you to turn off the power management, and it’s not the default module. Blacklisting the driver fixes that problem, too:

So creating /etc/modprobe.d/8192cu.conf with the following contents is sufficient:

blacklist rtl8192cu
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Bruce