Compare commits

...

13 Commits

Author SHA1 Message Date
SpacingBat3
825556e195 Linux 6.18 compat: Drop hmac_sha256 symbol (#277)
* Linux 6.18 compat: Drop `hmac_sha256` symbol

It looks like it is a backwards compatibility code piece, I could find any
occurence of it outside of the core/crypto/sha256.{c,h} and it looks like
driver uses `hmac_sha256_vector` directly anyway that this function was a
(legacy?) wrapper for.

Signed-off-by: SpacingBat3 <spacingbat3@gmail.com>

* chore: update README.md

Signed-off-by: SpacingBat3 <spacingbat3@gmail.com>

---------

Signed-off-by: SpacingBat3 <spacingbat3@gmail.com>
2025-12-03 16:33:29 +09:00
471877314b Linux 6.17 compat: radio_idx
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-10-09 00:50:24 +09:00
77a82dbac7 Linux 6.16 compat: more timers name change
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-06-11 03:20:47 -04:00
fcf8bf2936 chore: update README.md
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-06-10 10:10:00 -04:00
9d619f4c09 Linux 6.15 compat: rename timers
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-06-10 10:04:35 -04:00
9f48662d71 fix: stop use EXTRA_*FLAGS
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-06-10 09:54:14 -04:00
Slavic Dragovtev
1f0005d9be chore: fixes grammar in readme file. (#245)
Fixes grammar.
2025-05-26 15:10:53 -04:00
9624bd8943 chore: remove deprecated DKMS CLEAN
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-05-08 22:33:55 -04:00
fda90b7760 Linux 6.14 compat: get_txpower
Signed-off-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2025-04-06 00:22:33 -04:00
f0644acaa8 fix: dfs radar pw_long_hold_sum logic 2025-02-18 01:19:48 -05:00
1b30de3269 Linux 6.13 compat: namespace to string 2025-01-13 17:16:28 -05:00
2092b8d80d Linux 6.13 compat: cfg80211_rtw_set_monitor_channel
* Update ioctl_cfg80211.c

Add additional argument to cfg80211_rtw_set_monitor_channel
In Linux Kernel commit 9c4f83092775 a new argument is introduced to
cfg80211_rtw_set_monitor_channel.

Co-authored-by: Rin Cat (鈴猫) <rincat@rincat.dev>
2024-12-01 22:57:43 -05:00
Olivier Berger
d4425c0b8f Provide instructions for updating from git and rebuilding for DKMS (#238)
Close #206
2024-07-27 17:59:53 -04:00
13 changed files with 471 additions and 434 deletions

776
Makefile

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,30 @@
# REALTEK RTL88x2B USB Linux Driver # REALTEK RTL88x2B USB Linux Driver
**Current Driver Version**: 5.13.1-30 **Current Driver Version**: 5.13.1-30
**Support Kernel**: 2.6.24 ~ 6.10 (with unofficial patches) **Support Kernel**: 2.6.24 ~ 6.18 (with unofficial patches)
Linux in-tree rtw8822bu driver is working in process, check [this](https://lore.kernel.org/lkml/20220518082318.3898514-1-s.hauer@pengutronix.de/) patchset. Linux in-tree rtw8822bu driver is a work in progress. Check [this](https://lore.kernel.org/lkml/20220518082318.3898514-1-s.hauer@pengutronix.de/) patchset.
Official release note please check ReleaseNotes.pdf For official release notes please check ReleaseNotes.pdf.
**Note:** if you believe your device is **RTL8812BU** or **RTL8822BU** but after loaded the module no NIC shows up, the device ID maybe not in the driver whitelist. In this case please submit a new issue with `lsusb` result, and your device name, brand, website, etc. **Note:** if you believe your device is **RTL8812BU** or **RTL8822BU** but after loading the module no NIC shows up, the device ID maybe not be in the driver whitelist. In this case, please submit a new issue with `lsusb` result, and your device name, brand, website, etc.
This driver does *NOT* support newer Realtek 802.11ax (Wi-Fi 6) chipsets such as RTL8852BU.
## Linux 5.18+ and RTW88 Driver ## Linux 5.18+ and RTW88 Driver
Starting from Linux 5.18, some distributions have added experimental RTW88 USB support (include RTW88x2BU support). Starting from Linux 5.18, some distributions have added experimental RTW88 USB support (include RTW88x2BU support).
It is not yet stable but if it works well on your system, then you no longer need this driver. It is not yet stable but if it works well on your system, then you no longer need this driver.
But if it doesn't work or is unstable, you need to manually blacklist it because it has a higher loading priority than this external drivers. If it doesn't, then you need to manually blacklist it because it has a higher loading priority than this external drivers.
Check the currently loaded module using `lsmod`. If you see `rtw88_core`, `rtw88_usb`, or any name beginning with `rtw88_` then you are using the RTW88 driver. Check the currently loaded modules using `lsmod`. If you see `rtw88_core`, `rtw88_usb`, or any name beginning with `rtw88_` then you are using the RTW88 driver.
If you see `88x2bu` then you are using this RTW88x2BU driver. If you see `88x2bu` then you are using this RTW88x2BU driver.
To blacklist RTW88 8822bu USB driver, run the following command: To blacklist RTW88 8822bu USB driver run:
``` ```
echo "blacklist rtw88_8822bu" > /etc/modprobe.d/rtw8822bu.conf echo "blacklist rtw88_8822bu" > /etc/modprobe.d/rtw8822bu.conf
``` ```
And reboot your system. ...and reboot your system.
## Supported Devices ## Supported Devices
<details> <details>
@@ -115,7 +117,7 @@ And more.
## Manual installation ## Manual installation
### Clean ### Clean
* Make sure you cleaned old build files before builds new one * Make sure you clean old build files before building new ones
``` ```
make clean make clean
``` ```
@@ -140,25 +142,37 @@ sudo make install
sudo make uninstall sudo make uninstall
``` ```
## Manual DKMS installation ## Using DKMS (Dynamic Kernel Module Support)
Allows smooth integration with kernel updates.
### Initial DKMS installation
``` ```
git clone "https://github.com/RinCat/RTL88x2BU-Linux-Driver.git" /usr/src/rtl88x2bu-git git clone "https://github.com/RinCat/RTL88x2BU-Linux-Driver.git" /usr/src/rtl88x2bu-git
sed -i 's/PACKAGE_VERSION="@PKGVER@"/PACKAGE_VERSION="git"/g' /usr/src/rtl88x2bu-git/dkms.conf sed -i 's/PACKAGE_VERSION="@PKGVER@"/PACKAGE_VERSION="git"/g' /usr/src/rtl88x2bu-git/dkms.conf
dkms add -m rtl88x2bu -v git dkms add -m rtl88x2bu -v git
dkms autoinstall dkms autoinstall
``` ```
### Upgrading the driver, when already under DKMS
```
cd /usr/src/rtl88x2bu-git
git fetch
git rebase origin/master --autostash
dkms build rtl88x2bu/git --force
dkms install rtl88x2bu/git --force
```
# USB 3.0 Support # USB 3.0 Support
You can try use `modprobe 88x2bu rtw_switch_usb_mode=1` to force the adapter run under USB 3.0. But if your adapter/port/motherboard not support it, the driver will be in restart loop. Remove the parameter and reload the driver to restore. Alternatively, `modprobe 88x2bu rtw_switch_usb_mode=2` let\'s it run as USB 2 device. You can try using `modprobe 88x2bu rtw_switch_usb_mode=1` to force the adapter to run under USB 3.0. But if your adapter/port/motherboard does not support it, the driver will be stuck in a restart loop. Remove the parameter and reload the driver to restore. Alternatively, `modprobe 88x2bu rtw_switch_usb_mode=2` runs it as a USB 2 device.
Notice: If you had already loaded the moduel, use `modprobe -r 88x2bu` to unload it first. Notice: If you had already loaded the module, use `modprobe -r 88x2bu` to unload it first.
If you want to force a given mode permanently (even when switching the adapter across devices), create the file `/etc/modprobe.d/99-RTL88x2BU.conf` with the following content: If you want to force a given mode permanently (even when switching the adapter across devices), create the file `/etc/modprobe.d/99-RTL88x2BU.conf` with the following content:
`options 88x2bu rtw_switch_usb_mode=1` `options 88x2bu rtw_switch_usb_mode=1`
# Debug # Debug
Set debug log use `echo 5 > /proc/net/rtl88x2bu/log_level` or `modprobe 88x2bu rtw_drv_log_level=5` To set debug log use `echo 5 > /proc/net/rtl88x2bu/log_level` or `modprobe 88x2bu rtw_drv_log_level=5`
# Distribution # Distribution
* Archlinux AUR https://aur.archlinux.org/packages/rtl88x2bu-dkms-git/ * Archlinux AUR https://aur.archlinux.org/packages/rtl88x2bu-dkms-git/

View File

@@ -86,19 +86,3 @@ int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
_len[1] = SHA256_MAC_LEN; _len[1] = SHA256_MAC_LEN;
return sha256_vector(2, _addr, _len, mac); return sha256_vector(2, _addr, _len, mac);
} }
/**
* hmac_sha256 - HMAC-SHA256 over data buffer (RFC 2104)
* @key: Key for HMAC operations
* @key_len: Length of the key in bytes
* @data: Pointers to the data area
* @data_len: Length of the data area
* @mac: Buffer for the hash (32 bytes)
* Returns: 0 on success, -1 on failure
*/
int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac)
{
return hmac_sha256_vector(key, key_len, 1, &data, &data_len, mac);
}

View File

@@ -13,8 +13,6 @@
int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem, int hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac); const u8 *addr[], const size_t *len, u8 *mac);
int hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
size_t data_len, u8 *mac);
int sha256_prf(const u8 *key, size_t key_len, const char *label, int sha256_prf(const u8 *key, size_t key_len, const char *label,
const u8 *data, size_t data_len, u8 *buf, size_t buf_len); const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
int sha256_prf_bits(const u8 *key, size_t key_len, const char *label, int sha256_prf_bits(const u8 *key, size_t key_len, const char *label,

View File

@@ -1,7 +1,6 @@
PACKAGE_NAME="rtl88x2bu" PACKAGE_NAME="rtl88x2bu"
PACKAGE_VERSION="@PKGVER@" PACKAGE_VERSION="@PKGVER@"
MAKE="'make' -j$(nproc) KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build" MAKE="'make' -j$(nproc) KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build"
CLEAN="make clean"
BUILT_MODULE_NAME[0]="88x2bu" BUILT_MODULE_NAME[0]="88x2bu"
DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless" DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless"
AUTOINSTALL="yes" AUTOINSTALL="yes"

View File

@@ -1,4 +1,4 @@
EXTRA_CFLAGS += -I$(src)/hal/phydm ccflags-y += -I$(src)/hal/phydm
_PHYDM_FILES := hal/phydm/phydm_debug.o \ _PHYDM_FILES := hal/phydm/phydm_debug.o \
hal/phydm/phydm_antdiv.o\ hal/phydm/phydm_antdiv.o\

View File

@@ -1280,13 +1280,14 @@ void phydm_dfs_histogram_radar_distinguish(
dfs->pri_hold_sum[i] = dfs->pri_hold_sum[i] + dfs->pri_hold_sum[i] = dfs->pri_hold_sum[i] +
dfs->pri_hold[(dfs->hist_idx + 1) % 3][i] + dfs->pri_hold[(dfs->hist_idx + 1) % 3][i] +
dfs->pri_hold[(dfs->hist_idx + 2) % 3][i]; dfs->pri_hold[(dfs->hist_idx + 2) % 3][i];
}
/*@For long radar type*/ /*@For long radar type*/
for (j = 1; j < 4; j++) { for (j = 1; j < 4; j++) {
dfs->pw_long_hold_sum[i] = dfs->pw_long_hold_sum[i] + dfs->pw_long_hold_sum[i] = dfs->pw_long_hold_sum[i] +
dfs->pw_hold[(dfs->hist_long_idx + j) % 4][i]; dfs->pw_hold[(dfs->hist_long_idx + j) % 4][i];
dfs->pri_long_hold_sum[i] = dfs->pri_long_hold_sum[i] + dfs->pri_long_hold_sum[i] = dfs->pri_long_hold_sum[i] +
dfs->pri_hold[(dfs->hist_long_idx + j) % 4][i]; dfs->pri_hold[(dfs->hist_long_idx + j) % 4][i];
}
} }
dfs->hist_idx++; dfs->hist_idx++;

View File

@@ -725,11 +725,23 @@ void odm_initialize_timer(struct dm_struct *dm, struct phydm_timer_list *timer,
void odm_cancel_timer(struct dm_struct *dm, struct phydm_timer_list *timer) void odm_cancel_timer(struct dm_struct *dm, struct phydm_timer_list *timer)
{ {
#if (DM_ODM_SUPPORT_TYPE & ODM_AP) #if (DM_ODM_SUPPORT_TYPE & ODM_AP)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0))
timer_delete(timer);
#else
del_timer(timer); del_timer(timer);
#endif
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE) && defined(DM_ODM_CE_MAC80211) #elif (DM_ODM_SUPPORT_TYPE & ODM_CE) && defined(DM_ODM_CE_MAC80211)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0))
timer_delete(timer);
#else
del_timer(timer); del_timer(timer);
#endif
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE) && defined(DM_ODM_CE_MAC80211_V2) #elif (DM_ODM_SUPPORT_TYPE & ODM_CE) && defined(DM_ODM_CE_MAC80211_V2)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0))
timer_delete(&timer->timer);
#else
del_timer(&timer->timer); del_timer(&timer->timer);
#endif
#elif (DM_ODM_SUPPORT_TYPE & ODM_CE) #elif (DM_ODM_SUPPORT_TYPE & ODM_CE)
_cancel_timer_ex(timer); _cancel_timer_ex(timer);
#elif (DM_ODM_SUPPORT_TYPE & ODM_WIN) #elif (DM_ODM_SUPPORT_TYPE & ODM_WIN)

View File

@@ -1,4 +1,4 @@
EXTRA_CFLAGS += -I$(src)/hal/phydm ccflags-y += -I$(src)/hal/phydm
_PHYDM_FILES := hal/phydm/phydm_debug.o \ _PHYDM_FILES := hal/phydm/phydm_debug.o \
hal/phydm/phydm_interface.o\ hal/phydm/phydm_interface.o\

View File

@@ -357,7 +357,9 @@ static inline void timer_hdl(struct timer_list *in_timer)
static inline void timer_hdl(unsigned long cntx) static inline void timer_hdl(unsigned long cntx)
#endif #endif
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0))
_timer *ptimer = timer_container_of(ptimer, in_timer, timer);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
_timer *ptimer = from_timer(ptimer, in_timer, timer); _timer *ptimer = from_timer(ptimer, in_timer, timer);
#else #else
_timer *ptimer = (_timer *)cntx; _timer *ptimer = (_timer *)cntx;
@@ -387,12 +389,20 @@ __inline static void _set_timer(_timer *ptimer, u32 delay_time)
__inline static void _cancel_timer(_timer *ptimer, u8 *bcancelled) __inline static void _cancel_timer(_timer *ptimer, u8 *bcancelled)
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0))
*bcancelled = timer_delete_sync(&ptimer->timer) == 1 ? 1 : 0;
#else
*bcancelled = del_timer_sync(&ptimer->timer) == 1 ? 1 : 0; *bcancelled = del_timer_sync(&ptimer->timer) == 1 ? 1 : 0;
#endif
} }
__inline static void _cancel_timer_async(_timer *ptimer) __inline static void _cancel_timer_async(_timer *ptimer)
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0))
timer_delete(&ptimer->timer);
#else
del_timer(&ptimer->timer); del_timer(&ptimer->timer);
#endif
} }
static inline void _init_workitem(_workitem *pwork, void *pfunc, void *cntx) static inline void _init_workitem(_workitem *pwork, void *pfunc, void *cntx)

View File

@@ -3592,7 +3592,12 @@ static void cfg80211_rtw_abort_scan(struct wiphy *wiphy,
} }
#endif #endif
static int cfg80211_rtw_set_wiphy_params(struct wiphy *wiphy, u32 changed) static int cfg80211_rtw_set_wiphy_params(
struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
int radio_idx,
#endif
u32 changed)
{ {
#if 0 #if 0
struct iwm_priv *iwm = wiphy_to_iwm(wiphy); struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
@@ -4597,6 +4602,9 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
struct wireless_dev *wdev, struct wireless_dev *wdev,
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
int radio_idx,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) || defined(COMPAT_KERNEL_RELEASE) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)) || defined(COMPAT_KERNEL_RELEASE)
enum nl80211_tx_power_setting type, int mbm) enum nl80211_tx_power_setting type, int mbm)
#else #else
@@ -4658,6 +4666,12 @@ exit:
static int cfg80211_rtw_get_txpower(struct wiphy *wiphy, static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
struct wireless_dev *wdev, struct wireless_dev *wdev,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 17, 0))
int radio_idx,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0))
unsigned int link_id,
#endif #endif
int *dbm) int *dbm)
{ {
@@ -6955,6 +6969,9 @@ static void rtw_get_chbwoff_from_cfg80211_chan_def(
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */ #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */
static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
, struct net_device *dev
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
, struct cfg80211_chan_def *chandef , struct cfg80211_chan_def *chandef
#else #else

View File

@@ -32,7 +32,9 @@ atomic_t _malloc_size = ATOMIC_INIT(0);
#endif #endif
#endif /* DBG_MEMORY_LEAK */ #endif /* DBG_MEMORY_LEAK */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)
MODULE_IMPORT_NS("VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver");
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
#endif #endif

View File

@@ -1,8 +1,8 @@
EXTRA_CFLAGS += -DCONFIG_RTL8822B ccflags-y += -DCONFIG_RTL8822B
ifeq ($(CONFIG_MP_INCLUDED), y) ifeq ($(CONFIG_MP_INCLUDED), y)
### 8822B Default Enable VHT MP HW TX MODE ### ### 8822B Default Enable VHT MP HW TX MODE ###
#EXTRA_CFLAGS += -DCONFIG_MP_VHT_HW_TX_MODE #ccflags-y += -DCONFIG_MP_VHT_HW_TX_MODE
#CONFIG_MP_VHT_HW_TX_MODE = y #CONFIG_MP_VHT_HW_TX_MODE = y
endif endif