File rtl8852au.spec of Package rtl8852au

#
# spec file for package rtl8852au
#
#
# Copyright (c) 2024 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:		rtl8852au
Summary: 	Driver for rtl8832au/rtl8852au chipsets
Version:	1.15.0.1~14g7f3ea3f
Release:	0
Group:		System/Kernel
License:	GPL-2.0
Url:		https://github.com/lwfinger/rtl8852au
Source0:	%{name}-%{version}.tar
Source1:	preamble
Patch1:     leap.patch
#Patch2:     kernel68.patch

BuildRequires:  kernel-source
BuildRequires:	%{kernel_module_package_buildreqs}
BuildRequires:  pesign-obs-integration
BuildRequires:  bc


%kernel_module_package -n rtl8852au -x debug -x trace -c %_sourcedir/_projectcert.crt -p %_sourcedir/preamble

%description 
The driver supports rtl8832au/rtl8852au chipsets.

This driver currently handles the following devices:

    BUFFALO WI-U3-1200AX2(/N) with USB ID 0411:0312
    ASUS USB-AX56 with USB ID 0b05:1997
    ASUS USB-AX56 with USB ID 0b05:1a62
    EDUP EP-AX1696GS with USB ID 0bda:8832
    Fenvi FU-AX1800P with USB ID 0bda:885c
    Realtek Demo Board with USB ID 0bda:8832
    Realtek Demo Board with USB ID 0bda:885a
    Realtek Demo Board with USB ID 0bda:885c
    D-Link DWA-X1850 with USB ID 2001:3321
    TP-Link AX1800 with USB ID 2357:013f or 2357:0141
    ipTIME AX2000U with USB ID 0bda:8832
    ELECOM WDC-X1201DU3 with USB ID 056e:4020

The D-Link DWA-X1850 comes with a configuration that appears to be a USB disk,
which contains a Windows driver. If a 'lsusb' command shows the ID 0bda:1a2b,
then this disk is mounted. The way to avoid this is to edit either
file /usr/lib/udev/rules.d/40-usb_modeswitch.rules,
or /lib/udev/rules.d/40-usb_modeswitch.rules,
whichever is on your system, and add the following lines:

D-Link DWA-X1850 Wifi Dongle
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="usb_modeswitch '/%k'"




%package	KMP
Summary: 	The driver supports rtl8832au/rtl8852au chipsets.
Group:		System/Kernel

%description KMP
The driver supports rtl8832au/rtl8852au chipsets.

This driver currently handles the following devices:

    BUFFALO WI-U3-1200AX2(/N) with USB ID 0411:0312
    ASUS USB-AX56 with USB ID 0b05:1997
    ASUS USB-AX56 with USB ID 0b05:1a62
    EDUP EP-AX1696GS with USB ID 0bda:8832
    Fenvi FU-AX1800P with USB ID 0bda:885c
    Realtek Demo Board with USB ID 0bda:8832
    Realtek Demo Board with USB ID 0bda:885a
    Realtek Demo Board with USB ID 0bda:885c
    D-Link DWA-X1850 with USB ID 2001:3321
    TP-Link AX1800 with USB ID 2357:013f or 2357:0141
    ipTIME AX2000U with USB ID 0bda:8832
    ELECOM WDC-X1201DU3 with USB ID 056e:4020

The D-Link DWA-X1850 comes with a configuration that appears to be a USB disk,
which contains a Windows driver. If a 'lsusb' command shows the ID 0bda:1a2b,
then this disk is mounted. The way to avoid this is to edit either
file /usr/lib/udev/rules.d/40-usb_modeswitch.rules,
or /lib/udev/rules.d/40-usb_modeswitch.rules,
whichever is on your system, and add the following lines:

D-Link DWA-X1850 Wifi Dongle
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="usb_modeswitch '/%k'"


%prep
%setup -q
%patch -P 1 -p1
#%patch -P 2 -p1

set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
export CONFIG_RTL8852AU=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_RTL8852AU=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
openSUSE Build Service is sponsored by