I need help compiling Realtek 8822BU driver

Hello I have a usb stick with model number realtek 8812BU.
But I have trouble compiling the driver that ends with an error.
I have compiled before on opensuse but years ago so I’m a little rusty on the skill side nowadays.

I have tried both the included CD and cloning a github repository with guide from here:
https://dev.to/fmtweisszwerg/80211ac-controller-realtek-8822bu-on-linux-412-or-later-e8h

The installation works out fine on linux mint and the usb wireless started working after a reboot.

On Opensuse I followed the guide here to install the following
Thread: https://forums.opensuse.org/showthread.php/491320-kernel-header-install?p=2592043#post2592043


Patterns: 

   Development 

[X] Base Development
[X] Linux Kernel Development
[X] C/C++ Development

I checked that linux-glibc-devel is selected for installation when installing the OS.

I also noticed that the usb wireless stick does not appear when running lspci …but it does appear under linux mint but with a generic Realtek name before installing the driver.

This is the output when running the make:
*It does the same thing when running the included cd with drivers for linux.
For test I use virtualbox for now and the driver was compiled without any issues on linux mint also in virtualbox.
I have tried compiling on my physical computer but it gave the same result.


test@linux-hg1p:~> git clone https://github.com/FomalhautWeisszwerg/rtl8822bu.git
Cloning into 'rtl8822bu'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 752 (delta 0), reused 0 (delta 0), pack-reused 751
Receiving objects: 100% (752/752), 2.77 MiB | 2.80 MiB/s, done.
Resolving deltas: 100% (301/301), done.
test@linux-hg1p:~> cd rtl8822bu
test@linux-hg1p:~/rtl8822bu> make
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.12.14-lp150.12.25-default/build M=/home/test/rtl8822bu modules
make[1]: Entering directory '/usr/src/linux-4.12.14-lp150.12.25-obj/x86_64/default'
  CC [M]  /home/test/rtl8822bu/core/rtw_cmd.o
  CC [M]  /home/test/rtl8822bu/core/rtw_security.o
  CC [M]  /home/test/rtl8822bu/core/rtw_debug.o
  CC [M]  /home/test/rtl8822bu/core/rtw_io.o
  CC [M]  /home/test/rtl8822bu/core/rtw_ioctl_query.o
  CC [M]  /home/test/rtl8822bu/core/rtw_ioctl_set.o
  CC [M]  /home/test/rtl8822bu/core/rtw_ieee80211.o
  CC [M]  /home/test/rtl8822bu/core/rtw_mlme.o
  CC [M]  /home/test/rtl8822bu/core/rtw_mlme_ext.o
  CC [M]  /home/test/rtl8822bu/core/rtw_mi.o
  CC [M]  /home/test/rtl8822bu/core/rtw_wlan_util.o
  CC [M]  /home/test/rtl8822bu/core/rtw_vht.o
  CC [M]  /home/test/rtl8822bu/core/rtw_pwrctrl.o
  CC [M]  /home/test/rtl8822bu/core/rtw_rf.o
  CC [M]  /home/test/rtl8822bu/core/rtw_recv.o
  CC [M]  /home/test/rtl8822bu/core/rtw_sta_mgt.o
  CC [M]  /home/test/rtl8822bu/core/rtw_ap.o
  CC [M]  /home/test/rtl8822bu/core/rtw_xmit.o
  CC [M]  /home/test/rtl8822bu/core/rtw_p2p.o
  CC [M]  /home/test/rtl8822bu/core/rtw_tdls.o
  CC [M]  /home/test/rtl8822bu/core/rtw_br_ext.o
  CC [M]  /home/test/rtl8822bu/core/rtw_iol.o
  CC [M]  /home/test/rtl8822bu/core/rtw_sreset.o
  CC [M]  /home/test/rtl8822bu/core/rtw_btcoex.o
  CC [M]  /home/test/rtl8822bu/core/rtw_beamforming.o
  CC [M]  /home/test/rtl8822bu/core/rtw_odm.o
  CC [M]  /home/test/rtl8822bu/core/efuse/rtw_efuse.o
  CC [M]  /home/test/rtl8822bu/os_dep/osdep_service.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/os_intfs.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/usb_intf.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/usb_ops_linux.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/ioctl_linux.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/xmit_linux.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/mlme_linux.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/recv_linux.o
  CC [M]  /home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.o
/home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_cfg80211_indicate_connect’:
/home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:755:3: warning: ISO C90 forbids mixed declarations and code -Wdeclaration-after-statement]
   struct cfg80211_roam_info roam_info;
   ^~~~~~
/home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:768:21: error: passing argument 2 of ‘cfg80211_roamed’ from incompatible pointer type -Werror=incompatible-pointer-types]
                   , cur_network->network.MacAddress
                     ^~~~~~~~~~~
In file included from /home/test/rtl8822bu/include/osdep_service_linux.h:87:0,
                 from /home/test/rtl8822bu/include/osdep_service.h:41,
                 from /home/test/rtl8822bu/include/drv_types.h:32,
                 from /home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:22:
/usr/src/linux-4.12.14-lp150.12.25/include/net/cfg80211.h:5437:6: note: expected ‘struct cfg80211_roam_info *’ but argument is of type ‘unsigned char *’
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^~~~~~~~~~~~~~~
/home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:769:21: warning: passing argument 3 of ‘cfg80211_roamed’ makes integer from pointer without a cast -Wint-conversion]
                   , notify_channel
                     ^~~~~~~~~~~~~~
In file included from /home/test/rtl8822bu/include/osdep_service_linux.h:87:0,
                 from /home/test/rtl8822bu/include/osdep_service.h:41,
                 from /home/test/rtl8822bu/include/drv_types.h:32,
                 from /home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:22:
/usr/src/linux-4.12.14-lp150.12.25/include/net/cfg80211.h:5437:6: note: expected ‘gfp_t {aka unsigned int}’ but argument is of type ‘struct ieee80211_channel *’
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^~~~~~~~~~~~~~~
/home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:766:3: error: too many arguments to function ‘cfg80211_roamed’
   cfg80211_roamed(padapter->pnetdev
   ^~~~~~~~~~~~~~~
In file included from /home/test/rtl8822bu/include/osdep_service_linux.h:87:0,
                 from /home/test/rtl8822bu/include/osdep_service.h:41,
                 from /home/test/rtl8822bu/include/drv_types.h:32,
                 from /home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:22:
/usr/src/linux-4.12.14-lp150.12.25/include/net/cfg80211.h:5437:6: note: declared here
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
      ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-4.12.14-lp150.12.25/scripts/Makefile.build:328: /home/test/rtl8822bu/os_dep/linux/ioctl_cfg80211.o] Error 1
make[3]: *** [/usr/src/linux-4.12.14-lp150.12.25/Makefile:1564: _module_/home/test/rtl8822bu] Error 2
make[2]: *** [Makefile:152: sub-make] Error 2
make[1]: *** [Makefile:24: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-4.12.14-lp150.12.25-obj/x86_64/default'
make: *** [Makefile:1318: modules] Error 2
test@linux-hg1p:~/rtl8822bu> 

Any help is kindly appreciated :slight_smile:

USB devices never appear in ‘lspci’, please use ‘lsusb’.

So please post:

lsusb

I also noticed that the usb wireless stick does not appear when running lspci …but it does appear under linux mint but with a generic Realtek name before installing the driver.

Further to Knurpht’s advice, you can see if a driver is bound to a USB device by examining

usb-devices

There will be an output block pertaining to the wifi device and a driver loaded (if compatible with the chipset).

You can also run

dmesg |tail

just after such a device is connected to see how it is reported from a kernel perspective.

Don’t bother with the intel 7260, its just the permanent network adapter in this laptop and its working good…its the realtek that i’m trying to get working

linux-9as0:/home/test # lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation QM67 Express Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port Mobile SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
03:00.0 Network controller: Intel Corporation Wireless 7260 (rev 73)
05:00.0 System peripheral: Ricoh Co Ltd MMC/SD Host Controller (rev 07)
0d:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

Oh yes of course I forgot about lsusb:

linux-9as0:/home/test # lsusb
Bus 002 Device 004: ID 8087:07dc Intel Corp. 
Bus 002 Device 003: ID 0bda:b812 Realtek Semiconductor Corp. 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1)
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
linux-9as0:/home/test # dmesg |tail
   12.226932] Bluetooth: RFCOMM socket layer initialized
   12.226936] Bluetooth: RFCOMM ver 1.11
   13.348791] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
   16.767118] wlan0: authenticate with 78:11:dc:42:e6:aa
   16.770087] wlan0: send auth to 78:11:dc:42:e6:aa (try 1/3)
   16.771099] wlan0: authenticated
   16.772300] wlan0: associate with 78:11:dc:42:e6:aa (try 1/3)
   16.773207] wlan0: RX AssocResp from 78:11:dc:42:e6:aa (capab=0x831 status=0 aid=4)
   16.774714] wlan0: associated
   16.774751] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

linux-9as0:/home/test # uname -a
Linux linux-9as0 4.12.14-lp150.12.25-default #1 SMP Thu Nov 1 06:14:23 UTC 2018 (3fcf457) x86_64 x86_64 x86_64 GNU/Linux

Yep, we got that from your opening post. :wink:

The lsusb output gives us the chipset details, but little else…

Bus 002 Device 003: ID 0bda:b812 Realtek Semiconductor Corp. 

…which is why I requested that you run this instead…

usb-devices

You can filter the output for the device concerned with something like…

usb-devices|awk '/0bda/' RS="

"

Here we are

linux-9as0:/home/test # usb-devices|awk '/0bda/' RS="

"
T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=b812 Rev=02.10
S:  Manufacturer=Realtek
S:  Product=802.11ac NIC
S:  SerialNumber=123456
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 5 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

A search for b812 ends up here https://wikidevi.com/wiki/Realtek_RTL8812BU_USB_Module

Ok, that confirms no driver loaded.

Yes then the issue should be focused to solve what the issue is when I’m trying to compile the driver?

Yes, sorry about that. I just built the ‘88x2bu’ module from this repo…

GitHub - EntropicEffect/rtl8822bu: RTL8822BU Wireless Driver for Linux

git clone https://github.com/MeissnerEffect/rtl8822bu
cd rtl8822bu
make
sudo make install

…and it built without issue. I don’t have this hardware so I can’t test further unfortunately.

Huh…I tried that one GitHub - EntropicEffect/rtl8822bu: RTL8822BU Wireless Driver for Linux instead of GitHub - FomalhautWeisszwerg/rtl8822bu: RTL8822BU Wireless Driver for Linux >= 4.12
And it compiled without any errors. It working :smiley:
…it was that easy

linux-9as0:/home/test # usb-devices|awk '/0bda/' RS="

"
T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=b812 Rev=02.10
S:  Manufacturer=Realtek
S:  Product=802.11ac NIC
S:  SerialNumber=123456
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 5 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl88x2bu

Good to read of your success with this and glad to have been of help. :slight_smile:

Just wanted to thank you for your help! Your instructions helped me to get a RTL 8812BU USB WLAN Dongle to work on OpenSUSE 42.3.

Good to know.

FWIW, it is actually possible to build modules with DKMS (Dynamic Kernel Module Support) employed so that they get rebuilt automatically each time the kernel is updated. Sometimes, github offers source with DKMS configuration included so that it’s already done for you.

Otherwise the basic idea is explained here…

Or this packages:
https://software.opensuse.org/search?utf8=✓&q=rtl8822bu

Yes, that’s a good option -thanks Sauerland. I didn’t find those packages when I searched a few days ago.

Build on Sunday Nov 18 2018 because of:
https://forums.opensuse.org/showthread.php/533896-EDIMAX-WIFI-usb-adapter-AC1200-(EW-7822ULC)-and-Leap-15-not-working

Ok, thanks for doing that. It will be useful to others with this hardware. :slight_smile:

Hello,

A short message just to let you know the driver proposed by Sauerlandis working fine on Open suse 15.1 with adapapter TP-Link AC1300 (Archer T3U) with chip rtl8822bu. My architecture is a standart x86-64 PC.
Linux version 4.12.14-lp151.28.10-default (geeko@buildhost) (gcc version 7.4.0 (SUSE Linux) )

Thanks Sauerland for your job !

Now the driver does not give full power to this rtl8822bu with a max speed of 2MB/s. But I hope this will improve in the future…

BR,
Florent

I’m a used version of driver proposed by Sauerland at Tumbleweed and it works fine until last week after Tumbleweed migrated to Kernel 5.6 it’s not working anymore.
It seems like Kernel_stable_standard unsuccessfully built https://build.opensuse.org/package/show/home:Sauerland/rtl8822bu . Anybody could help me resolve that problem?

I’m trying to compile that package from source code(https://github.com/EntropicEffect/rtl8822bu) but get some problem(I’m a novice in C and compiling drivers)


/rtl8822bu/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_get_systime_us’:
/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:690:18: error: storage size of ‘ts’ isn’t known
  690 |  struct timespec ts;
      |                  ^~
/rtl8822bu/os_dep/linux/ioctl_cfg80211.c:692:3: error: implicit declaration of function ‘getboottime’; did you mean ‘getboottime64’? -Werror=implicit-function-declaration]
  692 |   getboottime(&ts);
      |   ^~~~~~~~~~~
      |   getboottime64