27 April 2019

WiFi Dongle: Realtek RTL8188

I have a mini PC without any built-in WiFi, and I would like to use a WiFi dongle so that it can connect to the Internet easily. I have a D-Link DWA-110 WiFi dongle I bought with about RM100 about 10 years ago. Unfortunately, it does not work properly any more: It would give up the connection once I have used it for a few minutes and its temperature becomes high.

So I decided to buy a new one. I bought one with only RM10 (including shipping fee), but I neither knew what brand it was nor what chipset it used. I just trusted the description on the web page that it would just work perfectly in Linux. Can't ask for much with only RM10.

Here is a photo showing the old (on the left, of course) and the new one. Behold! Technology advances fast!


However, I was very disappointed when I first used it: A speed test showed that its download speed was 'only' 0.4 Mbps?!! And I got a higher (?) upload speed of 'only' 2.5 Mbps?!! I tested it on two computers running Ubuntu 18.04 and Ubuntu 19.04 but still obtained the same results. For once I thought that I was terribly cheated by the seller.
(Edited: I have later tested this driver r8188eu with options rtw_power_mgnt=0 rtw_enusbss=0. The speed does improve greatly to about but is still slower, in the range of 30 Mbps+.)

I decided to find out more. I checked the CD that it shipped with and found that it included a Linux driver. Weird, because Linux kernel has usually included all popular drivers, and the manufacturer does not have to provide one. Then I found something: This dongle embeds RealTek RTL8188ETV, and somehow the driver included by the current version of Linux kernel is not good enough. Better drivers are available out there.

Here's the procedure I follow to set it up, tested to work fine on Ubuntu 18.04 and Ubuntu 19.04:

  1. Check the existing driver and add it into the blacklist:
    $ lsmod | grep 8188
    r8188eu
      ...
    $ vi /etc/modprobe.d/50-blacklist-8188eu.conf
    blacklist r8188eu
  2. Obtain the latest source code from https://github.com/quickreflex/rtl8188eus:
    $ git clone -b v5.2.2.4 https://github.com/quickreflex/rtl8188eus.git
  3. Compile, install, and use the driver:
    $ cd rtl8188eus/
    $ make all
    $ sudo make install
    $ sudo rmmod r8188eu
    $ sudo depmod -a
    $ sudo update-initramfs -u
    $ sudo modprobe 8188eu
  4. Test it now, or to play safe, reboot the computer and test it again.
A speed test shows that it can achieve 54 Mbps now, which is also the WiFi speed limit of my modem. So it finally works fine!

If you run into the problem of losing connection after some time (so far I haven't encountered this problem), you may want to set some options for the driver:
$ cat /sys/module/8188eu/parameters/rtw_power_mgnt  # Check the current value
$ cat /sys/module/8188eu/parameters/rtw_enusbss  # Check the current value
$ vi /etc/modprobe.d/8188eu.conf
options 8188eu rtw_power_mgnt=0 rtw_enusbss=0

Here are the values defined for these options:
  • rtw_power_mgnt
    • 0: disable power saving
    • 1: power saving on, minPS
    • 2: power saving on, maxPS
  • rtw_enusbss
    • 0: disable auto suspend
    • 1: enable auto suspend
External References:

No comments:

Post a Comment