File rtl8822bu.spec of Package rtl8822bu
#
# spec file for package rtl8822bu
#
#
# Copyright (c) 2025 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# needssslcertforbuild
%bcond_with concurrent_mode
Name:		rtl8822bu
Summary: 	RTL8822BU wireless lan driver
Version:	5.13.1~13.g4718773
Release:	0
Group:		System/Kernel
License:	GPL-2.0
Url:		https://github.com/RinCat/RTL88x2BU-Linux-Driver
Source0:	%{name}-%{version}.tar
Source1:	preamble
Patch1:     makefile.patch
Patch2:     new-usb-ID.patch
Patch3:     leap155.patch
Patch4:     kernel68.patch
Patch5:     leap156.patch
Patch6:     kernel618.patch
BuildRequires:	%kernel_module_package_buildreqs
%if 0%{?sle_version} > 150600
BuildRequires:  suse-module-tools-scriptlets
%endif
BuildRequires:  pesign-obs-integration
BuildRequires:  bc
Autoreqprov:	on
%kernel_module_package -n rtl8822bu -x debug -x trace -c %_sourcedir/_projectcert.crt -p %_sourcedir/preamble
%description 
RTL8822BU for Linux
Driver for 802.11ac USB Adapter with
RTL8822BU chipset
Only STA/Monitor Mode is supported, no AP.
A few known wireless cards that use this driver include
    ASUS AC-53 NANO
    ASUS AC1300 USB-AC55 B1
    D-Link DWA-182 (Revision D1 only)
    D-Link DWA-182
    Edimax EW-7822ULC
    Edimax EW-7822UTC
    Hawking Tech HW12ACU
    NetGear A6150 - AC1200
    TP-Link Archer T3U V1
    TP-Link Archer T4U V3
    TP-Link Archer T3U Plus V1
If you get lower speed, create a file with this content:
options rtl8822bu rtw_switch_usb_mode=1
You can do this by:
echo options 'rtl8822bu rtw_switch_usb_mode=1' >> /etc/modprobe.d/rtl8822bu.conf
Run dracut -f and reboot.
%package	KMP
Summary: 	RTL8822BU wireless lan driver
Group:		System/Kernel
%description KMP
RTL8822BU for Linux
Driver for 802.11ac USB Adapter with
RTL8822BU chipset
Only STA/Monitor Mode is supported, no AP.
A few known wireless cards that use this driver include
    ASUS AC-53 NANO
    ASUS AC1300 USB-AC55 B1
    D-Link DWA-182 (Revision D1 only)
    D-Link DWA-182
    Edimax EW-7822ULC
    Edimax EW-7822UTC
    Hawking Tech HW12ACU
    NetGear A6150 - AC1200
    TP-Link Archer T3U V1
    TP-Link Archer T4U V3
    TP-Link Archer T3U Plus V1
    
To get full spped on USB3, add
options rtl8822bu rtw_switch_usb_mode=1
to a file /etc/modprobe.d/rtl8822bu.conforms and run
dracut -f as root.
reboot.
%prep
%setup -q
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%if !%{with concurrent_mode}
%__sed -i 's|EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE|#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE|g' Makefile
%endif
set -- *
mkdir source
mv "$@" source/
mkdir obj
%build
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
export CONFIG_RTL8822BU=m
for flavor in %flavors_to_build; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
	make -C obj/$flavor KSRC=/usr/src/linux-obj/%_target_cpu/$flavor
done
%install
#install the module
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
export CONFIG_RTL8822BU=m
export BRP_PESIGN_FILES='*.ko'
export BRP_PESIGN_COMPRESS_MODULE="xz"
for flavor in %flavors_to_build; do
	make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
		M=$PWD/obj/$flavor
done
%clean
rm -rf $RPM_BUILD_ROOT
%changelog