Tutorial: Compiling a working kernel driver for rtl8192eu

Hello everyone,
After struggling with the matter for a while, I have successfully compiled a working driver for my 8192eu based wifi usb adapter.
I ended up compiling it on the Pi itself (cross compiling didn’t work too well), and after knowing what to do it was pretty straightforward.

Just for my convenience, I’m assuming you are running Raspberry Pi 1 with “3.18.13-1-osmc” kernel.
This is MOST LIKELY not your case, so make sure to “search and replace” my instructions as follows:
3.18.13-1-osmc: Change to the output of ‘uname -r’ command on your Pi.
rbp1: Change to rbp2 if you are on Raspberry Pi 2.
bcm2708: Change to bcm2709 if you are on Raspberry Pi 2.

Without further ado, here goes:

  1. Get your Pi ready for code compilation:
    sudo apt-get update
    sudo apt-get install build-essential git

  2. Get the appropriate kernel headers:
    sudo apt-get install rbp1-headers-3.18.13-1-osmc
    A bit more info about this is available here - Wiki - OSMC

  3. Add missing files to kernel headers:
    (On future versions of OSMC this would hopefully be unnecessary - Kernel Header missing architecture mach include files · Issue #167 · osmc/osmc · GitHub)
    sudo apt-get install rbp1-source-3.18.13-1-osmc
    sudo tar -xjvf /usr/src/rbp1-source-3.18.13-1-osmc.tar.bz2
    sudo cp -r /usr/src/rbp1-source-3.18.13-1-osmc/arch/arm/mach-bcm2708/include/mach/ /usr/src/rbp1-headers-3.18.13-1-osmc/arch/arm/include/
    sudo rm -rf /usr/src/rbp1-source-3.18.13-1-osmc
    sudo apt-get remove rbp1-source-3.18.13-1-osmc

  4. Get driver source, compile it, and install:
    (This is rtl8192EU_linux_v4.3.8_12406.20140929 found on GitHub)
    git clone GitHub - romcyncynatus/rtl8192eu: Realtek RTL8192EU Driver /home/osmc/rtl8192eu
    cd /home/osmc/rtl8192eu
    make ARCH=arm KVER=3.18.13-1-osmc KSRC=/usr/src/rbp1-headers-3.18.13-1-osmc
    sudo make ARCH=arm KVER=3.18.13-1-osmc KSRC=/usr/src/rbp1-headers-3.18.13-1-osmc install
    sudo bash -c ‘echo “options 8192eu rtw_power_mgnt=0 rtw_enusbss=0”>/etc/modprobe.d/8192eu.conf’

  5. Activate the newly created driver and get some info:
    modprobe 8192eu
    modinfo 8192eu

That’s it, you should now have a working wifi adapter, and you may proceed to configuring your network settings.
Good luck!

I am assuming that this could be fixed by a symbolic link?

Sam

I think you are right, but I delete the full kernel source after this step (It consumes a lot of space) so a link is less preferred.

This issue should be fixed in a more thorough manner in my opinion, and that’s including these header files in the package in first place. My Linux knowledge is far from sufficient though, so its hard for me to assist :expressionless:

The way Debian packages headers seems incomplete. I think I know how to resolve this.

S

Good to hear! I will be looking forward to it, as it would make future after-osmc-update compilations much easier.

BTW, any chance of getting this driver inserted into OSMC permanently? Like other common WiFi adapters?

Thanks,
Rom.

Yes

S

Awesome, thanks!

Thanks for the walk through.

I seem to have completed all the steps, but my wifi still doesn’t work. Lsusb does not list any driver for my device (dlink dw131 e1). I double checked that I changed all the paths in the code appropriately.

Any ideas how to bind the driver to the device?

What do you see when you do the modprobe/modinfo commands? Also, take a look at the dmesg, and please post the output of lsusb.

Edit: Currently, It seems that the driver doesn’t even try to manage 8192e-non-realtek-identified adapters. I’m assuming that your device’s vendor-id is DLink’s (instead of realtek).
I suggest you try to edit 8192eu/os_dep/linux/usb_initf.c and add your device vendor and id under 8192e according to lsusb command. When done, compile again and see what happens.

Please let us know of any additional vendor ID or product IDs if you add any so we can add them to our kernel

Sam

I found the other post from thelittlechef. I entered the link in his post to dlink’s downloads page, and it seems that there is a newer version of the driver then what I published here.

In addition, this version indeed deals with one more device, unsurprisingly dlink’s.
I’ll try to compile dlink’s version when I get home and update the OP accordingly.

Thank you thelittlechef for your finding :wink:

Sam, of course. I’ll update the git repo with the newer version. In the future I’ll send you a message if I change anything there.

Edit: I took the time to compare D-Link’s driver and the code in the repository. It’s exactly the same except for the patches that allows the driver to run without crashing on recent kernels, and the “support” for the DWA-131. I also noticed the the drivers’ version numbers are actually the same - its just the dates that are different.
Anyway, I added the DWA-131 vendor id and product id to the list, so it should work now.

thelittlechef, try to compile once more and let us know if it worked.
Good luck!

Just recompiled, the usb_intf.c files are updated with the new details (which match lsusb output) however, still no loading of the driver.

Dmesg records the usb being inserted, but has no mention of drivers. It records the manufacturer as Realtek.

Posting output is a little tricky as I don’t have a browser yet, and transcribing into my iPhone with all the autocorrect would not be pleasant!

Modprobe I see "error: could not insert 8192eu: operation not permitted.

If I do sudo modprobe then I just get the next command line. Dmesg after sudo modprobe has:
usbcore: registered new interface driver rtl8192eu
RTL871X: module init ret=0

Modinfo is a lot longer…

File name /lib/modules/ <…> /wireless/8192eu.ko
Version 4.3.1.1_11320.20140505
Author Realtek
Description Realtek
Depends: {Nothing written here}
Lots of “parm” fields with rtw_xx.int files

If you are sure that you got the driver file updated successfully (you should now see 3 aliases in modinfo instead of 2), just try to re-insert the adapter and see what happens (dmesg). Also, do you see the driver in lsmod? If you modprobe the driver, does it then appear in lsmod? Does it stay there for more then 2 minutes? Of course, reboot is not harmful as well.

Im really not an expert, but it basically feels to me that now it’s just a matter of playing with it a bit and it should work. The fact that the dlink driver is the same except for this line that adds DW131 tells me that the driver should work with no other special changes.

Keep us posted, and good luck!

I have just found a newer driver on GitHub. There is a reference for a Realtek archive there (rtl8192EU_linux_v4.3.8_12406.20140929.tar.gz), but couldn’t find it anywhere to further verify authenticity.
Quick diff between the versions indeed shows that its more recent from what we had until now.

I re-created the git repo with that version as base, and updated the support for D-Link DW131.

All working now! Many thanks - there is no way I would have figured it out without this page!

I started again with a fresh OSMC install, and followed the steps again. Not sure if I had messed up the last time, or if the updates made a difference. Either way, now connected wirelessly :smile:

Very nice to hear! It also proves that your adapter is supported as well.
Thanks for posting back :wink:

Hi Sam, sorry for my english.
I want to turn off the led of my wifi usb stick (TL-WN723N) with chipset RTL8188CUS. I have read that a recompile is needed, making changes in autoconf.h (link to the change required).
The problem is that I don’t know how to do this, and think that maybe you can help me and give me an easy way to get that I want.
Thanks, from Uruguay.
Carlos

PD: I run OSMC on a RPi 1 Model B (512MB RAM)

I have added support for the RTL8192EU to our kernel, so this should not be necessary with the next update of OSMC.

Cheers

Sam

Hi, me again.
You say that with the new update my wifi stick will stop bliking (this drives me crazy) without doing anything more???
Because it’s the only problem that I have with this stick, it works fine in the actual osmc, but the led blinking it’s annoying and don’t let me sleep.
Cheers,
Carlos