Wireless card stops working on Linux

2 Tips, especially for ath9k users:

Tip 1 – Unload and Reload your driver

Have you tried turning it off and turning it on again? No, seriously. Unload and reload the driver. I had an ath9k card that would work again for hours after doing this:

$ modprobe -r ath9k
$ modprobe ath9k

Eventually it stopped working and I replaced it with a D-Link DWA-131. I could have tried tip 2 first:

Tip 2 – Turn off hardware encryption

The parameter name varies between drivers, but the method is largely the same:

Create/Edit driver options file:

$ sudo nano /etc/modprobe.d/ath9k.conf

Put contents:

options ath9k nohwcrypt=1

Then reboot.

D-Link DWA-131 rev. E on Linux

Today’s topic: The D-Link DWA-131 Wireless N Nano USB Adapter.

dwa131e1image-lside011black

Early models in round cases used chipsets which now have inbuilt support (rev A- realtek 8192su, rev B – realtek 8192cu), but the newer ones (revision E) use a realtek 8192eu. There is a driver available from D-Link, but for me it was a kernel-panicky mess.

This is a list of instructions that I used to install a driver hosted by github user jpostma which seems to be the official realtek driver with patches (for what? not sure, but it works) applied.

User Brainiarc7 suggests using https://github.com/Mange/rtl8192eu-linux-driver which also has patches applied, as it is “Newer, and currently under maintenance.” I had a look at it, and it already has the DWA-131 device id, so I recommend you use it first.

This is for an ubuntu based linux distribution, but for others the principle is the same.

Plug the adapter in and determine the device ID, ensure it is 2001:3319 otherwise you have a different device:

$ lsusb
Bus 001 Device 004: ID 2001:3319 D-Link Corp.
...

Ensure you have the necessary prerequisites:

$ sudo apt-get install linux-headers-generic build-essential git

Clone the github repository with the driver source code:

$ git clone https://github.com/jpostma/rtl8192eu.git

Once the repository is downloaded, edit rtl8192eu/os_dep/linux/usb_intf.c
and add the device ID of our card, at around line 321.

#ifdef CONFIG_RTL8192E
    /*=== Realtek demoboard ===*/
    {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818B,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */
    {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDER_ID_REALTEK, 0x818C,0xff,0xff,0xff),.driver_info = RTL8192E},/* Default ID */
    {USB_DEVICE(0x2001, 0x3319),.driver_info = RTL8192E}, /* D-Link - DWA131 Rev. E */
#endif

Edit rtl8192eu/Makefile and change 2 things:

  1. At about line 16 add a # to comment out a flag that causes compile problems on recent kernels:
    #EXTRA_CFLAGS += -Wno-error=date-time
    
  2. At about line 42 edit the line to switch power saving off:
    From:

    CONFIG_POWER_SAVING = y
    

    To:

    CONFIG_POWER_SAVING = n
    

Compile the driver:

$ cd rtl8192eu
$ make

If there are any problems with compilation go back and fix them (install libraries, etc.) before proceeding.

Install and load the driver:

$ sudo make install
$ sudo modprobe 8192eu

This is what worked for me, and since setting it up it’s been flawless.