diff --git a/88x2bu.conf b/88x2bu.conf index d4630cc..f8dc6a2 100644 --- a/88x2bu.conf +++ b/88x2bu.conf @@ -2,8 +2,14 @@ # # Purpose: Allow easy access to specific driver options. # +# Note: pull-request: wireless-next-2022-12-12 +# wireless-next patches for v6.2 +# wifi: rtw88: Add rtw8822bu chipset support +# The following line blacklists the above in-kernel driver. +blacklist rtw88_8822bu +# # Edit the following line to change, add or delete options: -options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgnt=1 rtw_switch_usb_mode=0 +options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_usb_mode=0 # # After editing is complete, save this file (if using nano: Ctrl + x, y, Enter) # and reboot to activate the changes. @@ -73,16 +79,18 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn # # ----- # -# Country Code options ( rtw_country_code ) +# ISO 3166-1 alpha-2 Country Code options ( rtw_country_code ) # # Note: Allows the Country Code to be set in cases where it is unable to -# be obtained from the operating system. +# be obtained otherwise. # # Example for the US: rtw_country_code=US # Example for Panama: rtw_country_code=PA # Example for Norway: rtw_country_code=NO # Example for Kuwait: rtw_country_code=KW # Example for Taiwan: rtw_country_code=TW +# +# ISO 3166-1 alpha-2 codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 # # ----- # diff --git a/ARM64_RPI.sh b/ARM64_RPI.sh deleted file mode 100755 index f4b0c29..0000000 --- a/ARM64_RPI.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Purpose: Change settings in the Makefile to support compiling 64 bit -# operating systems for Raspberry Pi Hardware. -# -# To make this file executable: -# -# $ chmod +x ARM64_RPI.sh -# -# To execute this file: -# -# $ ./ARM64_RPI.sh - -sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile - -sed -i 's/CONFIG_PLATFORM_ARM_RPI = y/CONFIG_PLATFORM_ARM_RPI = n/g' Makefile - -sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile -RESULT=$? - -if [[ "$RESULT" != "0" ]]; then - echo "An error occurred and Raspberry Pi OS (64 bit) support was not turned on in Makefile." - exit 1 -else - echo "Raspberry Pi OS (64 bit) support was turned on in Makefile as planned." - exit 0 -fi diff --git a/ARM_RPI.sh b/ARM_RPI.sh deleted file mode 100755 index 684eecf..0000000 --- a/ARM_RPI.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# Purpose: Change settings in the Makefile to support compiling 32 bit -# operating systems for Raspberry Pi Hardware. -# -# To make this file executable (if necessary): -# -# $ chmod +x ARM_RPI.sh -# -# To execute this file: -# -# $ ./ARM_RPI.sh - -# getconf LONG_BIT (need to work on this) - -sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile - -sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile -RESULT=$? - -if [[ "$RESULT" != "0" ]]; then - echo "An error occurred and Raspberry Pi OS (32 bit) support was not turned on in Makefile." - exit 1 -else - echo "Raspberry Pi OS (32 bit) support was turned on in Makefile as planned." - exit 0 -fi - -sed -i 's/CONFIG_PLATFORM_ARM64_RPI = y/CONFIG_PLATFORM_ARM64_RPI = n/g' Makefile diff --git a/Kconfig b/Kconfig index 8b48040..3526cac 100644 --- a/Kconfig +++ b/Kconfig @@ -1,7 +1,6 @@ config RTL8822BU tristate "Realtek 8822B USB WiFi" depends on USB - select WIRELESS_EXT help Help message of RTL8822BU diff --git a/LICENSE b/LICENSE index 5f86869..38faea2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ /****************************************************************************** * - * Copyright(c) 2007 - 2021 Realtek Corporation. + * Copyright(c) 2007 - 2022 Realtek Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as diff --git a/Makefile b/Makefile index 1cd1c6a..39b818f 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,14 @@ EXTRA_CFLAGS += -Wno-misleading-indentation EXTRA_CFLAGS += -Wno-implicit-fallthrough #EXTRA_CFLAGS += -Wno-return-type +# Activates Concurrent Mode if uncommented +#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE + +# LED Control +EXTRA_CFLAGS += -DCONFIG_LED_CONTROL +EXTRA_CFLAGS += -DCONFIG_SW_LED -DCONFIG_RTW_SW_LED +EXTRA_CFLAGS += -DCONFIG_LED_ENABLE + # gcc-12 EXTRA_CFLAGS += -Wno-address EXTRA_CFLAGS += -Wframe-larger-than=1648 @@ -150,9 +158,8 @@ CONFIG_LAYER2_ROAMING = y #bit0: ROAM_ON_EXPIRED, #bit1: ROAM_ON_RESUME, #bit2: ROAM_ACTIVE CONFIG_ROAMING_FLAG = 0x3 ###################### Platform Related ####################### -CONFIG_PLATFORM_I386_PC = y -CONFIG_PLATFORM_ARM_RPI = n -CONFIG_PLATFORM_ARM64_RPI = n +CONFIG_PLATFORM_AUTODETECT = y +CONFIG_PLATFORM_I386_PC = n CONFIG_PLATFORM_ANDROID_X86 = n CONFIG_PLATFORM_ANDROID_INTEL_X86 = n CONFIG_PLATFORM_JB_X86 = n @@ -312,8 +319,8 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8188E _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8188EPwrSeq.o\ - hal/$(RTL871X)/$(RTL871X)_xmit.o\ + hal/$(RTL871X)/Hal8188EPwrSeq.o \ + hal/$(RTL871X)/$(RTL871X)_xmit.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -368,8 +375,8 @@ MODULE_NAME = 8192ee endif EXTRA_CFLAGS += -DCONFIG_RTL8192E _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8192EPwrSeq.o\ - hal/$(RTL871X)/$(RTL871X)_xmit.o\ + hal/$(RTL871X)/Hal8192EPwrSeq.o \ + hal/$(RTL871X)/$(RTL871X)_xmit.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -428,8 +435,8 @@ endif _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ hal/$(RTL871X)/Hal8812PwrSeq.o \ - hal/$(RTL871X)/Hal8821APwrSeq.o\ - hal/$(RTL871X)/$(RTL871X)_xmit.o\ + hal/$(RTL871X)/Hal8821APwrSeq.o \ + hal/$(RTL871X)/$(RTL871X)_xmit.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -535,7 +542,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8723B _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8723BPwrSeq.o\ + hal/$(RTL871X)/Hal8723BPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -597,7 +604,7 @@ EXTRA_CFLAGS += -DCONFIG_RTL8814A _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ hal/$(RTL871X)/Hal8814PwrSeq.o \ - hal/$(RTL871X)/$(RTL871X)_xmit.o\ + hal/$(RTL871X)/$(RTL871X)_xmit.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -657,7 +664,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8703B _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8703BPwrSeq.o\ + hal/$(RTL871X)/Hal8703BPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -713,7 +720,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8723D _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8723DPwrSeq.o\ + hal/$(RTL871X)/Hal8723DPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -781,7 +788,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8188F _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8188FPwrSeq.o\ + hal/$(RTL871X)/Hal8188FPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -828,7 +835,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8188GTV _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8188GTVPwrSeq.o\ + hal/$(RTL871X)/Hal8188GTVPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -906,7 +913,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8710B _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8710BPwrSeq.o\ + hal/$(RTL871X)/Hal8710BPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -953,7 +960,7 @@ endif EXTRA_CFLAGS += -DCONFIG_RTL8192F _HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \ - hal/$(RTL871X)/Hal8192FPwrSeq.o\ + hal/$(RTL871X)/Hal8192FPwrSeq.o \ hal/$(RTL871X)/$(RTL871X)_sreset.o _HAL_INTFS_FILES += hal/$(RTL871X)/$(RTL871X)_hal_init.o \ @@ -1346,12 +1353,44 @@ EXTRA_CFLAGS += -DCONFIG_RTW_MBO -DCONFIG_RTW_80211K -DCONFIG_RTW_WNM -DCONFIG_R EXTRA_CFLAGS += -DCONFIG_RTW_80211R endif -ifeq ($(CONFIG_PLATFORM_I386_PC), y) -ifeq ($(CONFIG_CONCURRENT_MODE), y) -EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE -endif +# *** AUTODETECT *** +ifeq ($(CONFIG_PLATFORM_AUTODETECT), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT + +SUBARCH := $(shell uname -m) + +ifeq ($(SUBARCH), aarch64) +SUBARCH := arm64 +endif + +ifeq ($(SUBARCH), armv7l) +SUBARCH := arm +endif + +ifeq ($(SUBARCH), armv6l) +SUBARCH := arm +endif + +ARCH ?= $(SUBARCH) + +CROSS_COMPILE ?= +KVER ?= $(shell uname -r) +KSRC := /lib/modules/$(KVER)/build +MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ +INSTALL_PREFIX := +STAGINGMODDIR := /lib/modules/$(KVER)/kernel/drivers/staging + +# Platform Specific Flags may be Needed in some Situations +#EXTRA_CFLAGS += -DCONFIG_PLATFORM_ANDROID +# End of Platform Specific Flags +endif +# *** End AUTODETECT *** + +ifeq ($(CONFIG_PLATFORM_I386_PC), y) +EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN +EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT + SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= @@ -1362,41 +1401,6 @@ INSTALL_PREFIX := STAGINGMODDIR := /lib/modules/$(KVER)/kernel/drivers/staging endif -### START RASPBERRY PI OS SUPPORT - -ifeq ($(CONFIG_PLATFORM_ARM_RPI), y) -ifeq ($(CONFIG_CONCURRENT_MODE), y) -EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE -endif -EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -#EXTRA_CFLAGS += -DPLATFORM_LINUX -ARCH ?= arm -CROSS_COMPILE ?= -KVER ?= $(shell uname -r) -KSRC := /lib/modules/$(KVER)/build -MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ -INSTALL_PREFIX := -endif - -ifeq ($(CONFIG_PLATFORM_ARM64_RPI), y) -ifeq ($(CONFIG_CONCURRENT_MODE), y) -EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE -endif -EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -#EXTRA_CFLAGS += -DPLATFORM_LINUX -EXTRA_CFLAGS += -fno-stack-protector -ARCH ?= arm64 -CROSS_COMPILE ?= -KVER ?= $(shell uname -r) -KSRC := /lib/modules/$(KVER)/build -MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ -INSTALL_PREFIX := -endif - -### END RASPBERRY PI OS SUPPORT - ifeq ($(CONFIG_PLATFORM_NV_TK1), y) EXTRA_CFLAGS += -DCONFIG_PLATFORM_NV_TK1 EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN diff --git a/README.md b/README.md index 7f671d8..bbf2736 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,12 @@ ------ - -#### [Go to Main Menu](https://github.com/morrownr/USB-WiFi) - ------ - -#### A FAQ is available at the end of this document. - ------ - -#### Problem reports go in `Issues`. Include the information obtained with: - -``` -sudo uname -mr; mokutil --sb-state; lsusb; rfkill list all; dkms status; iw dev; iw reg get -``` - ------ - ## 88x2bu ( 88x2bu.ko ) :rocket: ## Linux Driver for USB WiFi Adapters that are based on the RTL8812BU and RTL8822BU Chipsets - v5.13.1 (Realtek) (20210702) plus updates from the Linux community +Note: Please read "supported-device-IDs" for information about how to +confirm that this is the correct driver for your adapter. + ### Features - IEEE 802.11 b/g/n/ac WiFi compliant @@ -39,13 +24,11 @@ sudo uname -mr; mokutil --sb-state; lsusb; rfkill list all; dkms status; iw dev; - AP mode DFS channel support - Miracast - Supported interface modes - * IBSS * Managed * Monitor (see FAQ) * AP (see FAQ) * P2P-client * P2P-GO - * Concurrent (see `Concurrent_Mode.md` in the `docs` folder.) - Log level control - LED control - Power saving control @@ -53,29 +36,33 @@ sudo uname -mr; mokutil --sb-state; lsusb; rfkill list all; dkms status; iw dev; - AP mode DFS channel control - USB mode control -### Compatible CPUs +### A FAQ is available at the end of this document. -- x86, amd64 -- ARM, ARM64 +### Compatible CPU Architectures + +- x86, i686 +- x86-64, amd64 +- armv7l, armv6l (arm) +- aarch64 (arm64) ### Compatible Kernels - Kernels: 4.19 - 5.11 (Realtek) - Kernels: 5.12 - 6.1 (community support) +### Tested Compilers + +- gcc 9, 10, 11 and 12 + ### Tested Linux Distributions -Note: One of the goals of this project is to provide driver support that -is easy to install and works reliably on many distros. Meeting this goal -depends on you to report your recommendations and updated information. -If you see information that needs to be updated, please report the -updated information and if you do not see adequate support for -items such as Installation Steps 2, 3 and 9, and you know what updates -need to added or you can get that information, please provide it so that -the Installation Steps can be improved. +Note: The information in this section depends largely on user reports which can +be provided via PR or message in Issues. - Arch Linux (kernels 5.4 and 5.11) +- Armbian_22.11.1 (kernel 5.15) (Rock 4 SE (Rock 4b image with xfce)) + - Debian 11 (kernels 5.10 and 5.15) - Fedora (kernel 5.11) @@ -92,13 +79,27 @@ the Installation Steps can be improved. - RHEL 8.4 and 8.6 (kernel 4.18.0) -- Ubuntu 22.04 (kernel 5.15 and 5.17.5) +- SkiffOS for Odroid XU4 (ARM 32 bit) (kernel 6.0.7) + +- Ubuntu 22.04 (kernel 5.15) and 22.10 (kernel 5.19) - Void Linux (kernel 5.18) +Note: Red Hat Enterprise Linux (RHEL) and distros based on RHEL are not +supported due to the way kernel patches are handled. I will support +knowledgable RHEL developers if they want to merge the required +support and keep it current. + +Note: Android is not supported but I will support knowledgable Android +developers if they want to merge and keep current the required support +(most likely just instructions about how to compile and maybe a modification +or two to the Makefile). + + ### Download Locations for Tested Linux Distributions - [Arch Linux](https://www.archlinux.org) +- [Armbian](https://www.armbian.com/) - [Debian](https://www.debian.org/) - [Fedora](https://getfedora.org) - [Kali Linux](https://www.kali.org/) @@ -106,6 +107,7 @@ the Installation Steps can be improved. - [openSUSE](https://www.opensuse.org/) - [Raspberry Pi OS](https://www.raspberrypi.org) - [RHEL](https://www.redhat.com) +- [SkiffOS](https://github.com/skiffos/skiffos/) - [Ubuntu](https://www.ubuntu.com) - [Void Linux](https://voidlinux.org/) @@ -118,7 +120,9 @@ the Installation Steps can be improved. ### Compatible Devices -Warning: Adapters listed here are not recommended for purchase as I do not recommend Linux users buy Realtek based USB WiFi adapters due to the lack of mac80211 technology drivers that are supported in-kernel as called for by Linux Wireless Standards. This repo is supported for the benefit of Linux users who already have adapters based on the supported chipsets. If you are looking for information about what adapter to buy, click [here](https://github.com/morrownr/USB-WiFi) for information about and links to recommended adapters. +Warning: If you are looking for information about what adapter to buy, +click [here](https://github.com/morrownr/USB-WiFi) and look for Main Menu +item 2 which will show information about and links to recommended adapters. * [ALFA AWUS036ACU](https://store.rokland.com/collections/wi-fi-usb-adapters/products/alfa-awus036acu-802-11ac-ac1200-dual-band-wifi-usb-dongle-rp-sma-antennas) * ASUS AC1300 USB-AC55 B1 @@ -135,8 +139,6 @@ Warning: Adapters listed here are not recommended for purchase as I do not recom * TRENDnet TEW-808UBM * Numerous additional products that are based on the supported chipsets -Note: Please read "supported-device-IDs" for information about how to confirm the correct driver for your adapter. - ### Installation Information Warning: Installing multiple drivers for the same hardware usually does @@ -153,13 +155,14 @@ driver by running the following command: sudo dkms status ``` -Warning: If you decide to upgrade to a new version of kernel such as 5.18 to 5.19, you -need to remove the driver you have installed and install the newest available before -installing the new kernel. Use the following commands in the driver directory: +Warning: If you decide to upgrade to a new version of kernel such as +5.15 to 5.19, you need to remove the driver you have installed and +install the newest available before installing the new kernel. Use the +following commands in the driver directory: ``` -$ git pull $ sudo ./remove-driver.sh +$ git pull $ sudo ./install-driver.sh ``` @@ -181,27 +184,57 @@ can be executed as the `root` user. (If the command `sudo echo Yes` returns "Yes", with or without having to enter your password, you do have sufficient access rights.) -DKMS is used for the installation. DKMS is a system utility which will -automatically recompile and reinstall this driver when a new kernel is -installed. DKMS is provided by and maintained by Dell. +DKMS is used for the installation if available. DKMS is a system utility +which will automatically recompile and reinstall this driver when a new +kernel is installed. DKMS is provided by and maintained by Dell. -It is recommended that you do not delete the driver directory after installation -as the directory contains information and scripts that you may need in the future. +It is recommended that you do not delete the driver directory after +installation as the directory contains information and scripts that you +may need in the future. -Secure mode: The primary installation script, `install-driver.sh`, will support -secure mode... if your distro supports the method dkms uses. I regularly test the -installation script on systems with secure mode on. It works very well on Ubuntu based -distros. Some distros, such as Raspberry Pi OS, do not support secure mode because the -hardware they support does not support secure mode making it unnecessary. There are -distros that do not work with the support currently in use. If you install this driver -and, after a reboot, the driver is not working, you can go into the BIOS and temporarily -turn secure mode off to see if secure mode is the problem. +Secure Boot: The installation script, `install-driver.sh`, will +automatically support secure boot... if your distro supports the method +dkms uses. I regularly test the installation script on systems with +secure boot on. It works seemlessly on modern Ubuntu based distros as +long as secure boot was set up properly during the installation of the +operating system. Some distros, such as the Raspberry Pi OS, do not +support secure boot because the hardware they support does not support +secure boot making it unnecessary to attempt to support it. There are +distros that may require additional steps to sign the driver for secure +boot operation. Fedora is an example. In installation Step 3, note that +`openssl` must be installed as Fedora does not install it by default. +There will also be another step for Fedora after `install-driver.sh` +script is completed. This will be explained in the instructions at the +appropriate time. Overall, secure boot requires that +`openssl` and `mokutil` be installed and that additional steps be +performed if necessary. To test if secure boot is the problem: If you +install this driver and, after a reboot, the driver is not working, you +can go into the BIOS and temporarily turn secure boot off to see if +secure boot is the problem. + +Please ensure the ISO 3166-1 alpha-2 Country Code is set in your Linux distro. +If it is not set, you will likely have problems accessing some channels, especially +5 Ghz and 6 GHz channels. To set your Country Code: + +``` +iw reg set US +``` + +If you are not in the US, please use the country code for your country. See: + +ISO 3166-1 alpha-2 codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + +To check if your country code is properly set: + +``` +iw reg get +``` ### Installation Steps Note: The installation instructions are for the novice user. Experienced users are -welcome to alter the installation to meet their needs. Support will be provided based -on the steps below. +welcome to alter the installation to meet their needs. Support will be provided, +on a best effort basis, based on the steps below. #### Step 1: Open a terminal (e.g. Ctrl+Alt+T) @@ -211,7 +244,7 @@ Note: If your Linux distro does not fall into one of options listed below, you will need to research how to update and upgrade your system packages. -- Option for Debian based distributions such as Ubuntu, Linux Mint, Kali and Raspberry Pi OS +- Option for Debian based distributions such as Ubuntu, Kali, Armbian and Raspberry Pi OS ``` sudo apt update && sudo apt upgrade @@ -251,7 +284,17 @@ sudo reboot #### Step 3: Install the required packages (select the option for the OS you are using) -- Option for Raspberry Pi OS (ARM/ARM64) +Note: If your Linux distro does not fall into one of options listed +below, you will need to research how to properly setup up the development +environment for your system. + +- Option for Armbian (arm64) + +``` +sudo apt install -y build-essential +``` + +- Option for Raspberry Pi OS (arm/arm64) ``` sudo apt install -y raspberrypi-kernel-headers build-essential bc dkms git @@ -260,19 +303,21 @@ sudo apt install -y raspberrypi-kernel-headers build-essential bc dkms git - Option for Debian, Kali, and Raspberry Pi Desktop (x86) ``` -sudo apt install -y linux-headers-$(uname -r) build-essential bc dkms git libelf-dev +sudo apt install -y linux-headers-$(uname -r) build-essential bc dkms git libelf-dev rfkill iw ``` - Option for Ubuntu (all official flavors) and the numerous Ubuntu based distros ``` -sudo apt install -y build-essential dkms git +sudo apt install -y build-essential dkms git iw ``` - Option for Fedora +Note: Installing `openssl` is only necessary for secure boot support. + ``` -sudo dnf -y install git dkms kernel-devel kernel-debug-devel +sudo dnf -y install git dkms kernel-devel openssl ``` - Option for openSUSE @@ -293,12 +338,18 @@ sudo apk add linux-lts-dev make gcc sudo xbps-install linux-headers dkms git make ``` -- Options for Arch and Manjaro +- Options for Arch and Manjaro (if using Manjaro for RasPi4B, see note) If using pacman ``` -sudo pacman -S --noconfirm linux-headers dkms git +sudo pacman -S --noconfirm linux-headers dkms git bc +``` + +Note: The following is needed if using Manjaro for RasPi4B. + +``` +sudo pacman -S --noconfirm linux-rpi4-headers dkms git bc ``` Note: If you are asked to choose a provider, make sure to choose the one @@ -334,58 +385,7 @@ git clone https://github.com/morrownr/88x2bu-20210702.git cd ~/src/88x2bu-20210702 ``` -#### Step 8: (optional) Enable Concurrent Mode ( cmode-on.sh ) - -Note: see `Concurrent_Mode.md` in the `docs` folder to help determine -whether you want to enable Concurrent Mode. - -``` -./cmode-on.sh -``` - -#### Step 9: Run a script to reconfigure for ARM or ARM64 based systems - -Warning: This driver defaults to supporting x86 and amd64 based systems -and this step should be `skipped` if your system is powered by an x86, -amd64 or compatible CPU. - -Note: If your system is powered by an ARM or ARM64 based Raspberry Pi, -then one of the following scripts should be executed: - -- Option for the following listed operating systems to be installed to -Raspberry Pi hardware - -``` - * Raspberry Pi OS (32 bit) -``` - -``` -./ARM_RPI.sh -``` - -- Option for the following listed operating systems to be installed to -Raspberry Pi hardware - -``` - * Raspberry Pi OS (64 bit) - * Kali Linux RPI ARM64 - * Ubuntu for Raspberry Pi -``` - -``` -./ARM64_RPI.sh -``` - -Note: ARM or ARM64 based systems not listed above will likely require -modifications similar to those provided in the above scripts but the -number and variety of different ARM and ARM64 based systems makes -supporting each system unpractical so you will need to research the -needs of your system and make the appropriate modifications. If you -discover the settings and make a new script that works with your ARM or -ARM64 based system, you are welcome to submit the script and information -to be included here. - -#### Step 10: Run the installation script ( install-driver.sh ) +#### Step 8: Run the installation script ( install-driver.sh ) Note: For automated builds (non-interactive), use _NoPrompt_ as an option. @@ -397,6 +397,11 @@ Note: If you elect to skip the reboot at the end of the installation script, the driver may not load immediately and the driver options will not be applied. Rebooting is strongly recommended. +Note: Fedora users that have secure boot turned on should run the following to +enroll the key: + +$ sudo mokutil --import /var/lib/dkms/mok.pub + Manual build instructions: The above script automates the installation process, however, if you want to or need to do a command line installation, use the following: @@ -434,14 +439,46 @@ Note: Documentation for Driver Options is included in the file `88x2bu.conf`. ----- -### Removal of the Driver ( remove-driver.sh or remove-driver-no-dkms.sh ) +### Upgrading the Driver + +Note: Linux development is continuous therefore work on this driver is continuous. + +Note: Upgrading the driver is advised in the following situations: + +- if a new or updated version of the driver needs to be installed +- if a distro version upgrade is going to be installed (i.e. going from kernel 5.10 to kernel 5.15) + +#### Step 1: Move to the driver directory + +``` +cd ~/src/88x2bu-20210702 +``` + +#### Step 2: Remove the currently installed driver + +``` +sudo ./remove-driver.sh +``` + +#### Step 3: Pull updated code from this repo + +``` +git pull +``` + +#### Step 4: Install the driver + +``` +sudo ./install-driver.sh +``` + +----- +### Removal of the Driver ( remove-driver.sh ) Note: Removing the driver is advised in the following situations: - if driver installation fails - if the driver is no longer needed -- if a new or updated version of the driver needs to be installed -- if a distro version upgrade is going to be installed (i.e. going from kernel 5.10 to kernel 5.15) Note: The following removes everything that has been installed, with the exception of the packages installed in Step 3 and the driver directory. @@ -483,7 +520,7 @@ Note: These are general recommendations, some of which may not apply to your spe - Best location for the WiFi router/access point: Near center of apartment or house, at least a couple of feet away from walls, in an elevated location. You may have to test to see what the best location is in your environment. -- Check congestion: There are apps available for smart phones that allow you to check the congestion levels on WiFi channels. The apps generally go by the name of ```WiFi Analyzer``` or something similar. +- Check congestion: There are apps available for smart phones that allow you to get an idea of the congestion levels on WiFi channels. The apps generally go by the name of ```WiFi Analyzer``` or something similar. After making and saving changes, reboot the router. diff --git a/alpha-2_Country_Codes b/alpha-2_Country_Codes new file mode 100644 index 0000000..c9036ae --- /dev/null +++ b/alpha-2_Country_Codes @@ -0,0 +1,610 @@ +2022-12-18 + +Instructions for setting the ISO 3166-1 alpha-2 Country Code in your Linux +distro. If it is not set, you may have problems using some channels, especially +5 Ghz and 6 GHz channels. To set your Country Code from the command line +interface: + +Note: Package "iw" must be installed. + +``` +sudo iw reg set XX +``` + +Where XX is the country code for your country. See the list of country codes +below. + +To check if your country code is properly set: + +``` +iw reg get +``` + +``` +ISO 3166-1 alpha-2 Country Codes + +Name Code + +Afghanistan AF + +Aland +Islands AX + +Albania AL + +Algeria DZ + +American +Samoa AS + +Andorra AD + +Angola AO + +Anguilla AI + +Antarctica AQ + +Antigua and +Barbuda AG + +Argentina AR + +Armenia AM + +Aruba AW + +Australia AU + +Austria AT + +Azerbaijan AZ + +Bahamas BS + +Bahrain BH + +Bangladesh BD + +Barbados BB + +Belarus BY + +Belgium BE + +Belize BZ + +Benin BJ + +Bermuda BM + +Bhutan BT + +Bolivia BO + +Bonaire, Sint +Eustatius and +Saba BQ + +Bosnia and +Herzegovina BA + +Botswana BW + +Bouvet +Island BV + +Brazil BR + +British Indian +Ocean +Territory IO + +Brunei +Darussalam BN + +Bulgaria BG + +Burkina +Faso BF + +Burundi BI + +Cambodia KH + +Cameroon CM + +Canada CA + +Cape Verde CV + +Cayman +Islands KY + +Central +African +Republic CF + +Chad TD + +Chile CL + +China CN + +Christmas +Island CX + +Cocos +(Keeling) +Islands CC + +Colombia CO + +Comoros KM + +Congo CG + +Congo CD + +Cook +Islands CK + +Costa Rica CR + +Côte +d'Ivoire CI + +Croatia HR + +Cuba CU + +Curaçao CW + +Cyprus CY + +Czech +Republic CZ + +Denmark DK + +Djibouti DJ + +Dominica DM + +Dominican +Republic DO + +Ecuador EC + +Egypt EG + +El Salvador SV + +Equatorial +Guinea GQ + +Eritrea ER + +Estonia EE + +Ethiopia ET + +Falkland +Islands +(Malvinas) FK + +Faroe +Islands FO + +Fiji FJ + +Finland FI + +France FR + +French +Guiana GF + +French +Polynesia PF + +French +Southern +Territories TF + +Gabon GA + +Gambia GM + +Georgia GE + +Germany DE + +Ghana GH + +Gibraltar GI + +Greece GR + +Greenland GL + +Grenada GD + +Guadeloupe GP + +Guam GU + +Guatemala GT + +Guernsey GG + +Guinea GN + +Guinea- +Bissau GW + +Guyana GY + +Haiti HT + +Heard Island +and +McDonald +Islands HM + +Holy See +(Vatican City +State) VA + +Honduras HN + +Hong Kong HK + +Hungary HU + +Iceland IS + +India IN + +Indonesia ID + +Iran, Islamic +Republic of IR + +Iraq IQ + +Ireland IE + +Isle of Man IM + +Israel IL + +Italy IT + +Jamaica JM + +Japan JP + +Jersey JE + +Jordan JO + +Kazakhstan KZ + +Kenya KE + +Kiribati KI + +Korea, +Democratic +People's +Republic of KP + +Korea, +Republic of KR + +Kuwait KW + +Kyrgyzstan KG + +Lao People's +Democratic +Republic LA + +Latvia LV + +Lebanon LB + +Lesotho LS + +Liberia LR + +Libya LY + +Liechtenstein LI + +Lithuania LT + +Luxembourg LU + +Macao MO + +Macedonia, +the Former +Yugoslav +Republic of MK + +Madagascar MG + +Malawi MW + +Malaysia MY + +Maldives MV + +Mali ML + +Malta MT + +Marshall +Islands MH + +Martinique MQ + +Mauritania MR + +Mauritius MU + +Mayotte YT + +Mexico MX + +Micronesia, +Federated +States of FM + +Moldova, +Republic of MD + +Monaco MC + +Mongolia MN + +Montenegro ME + +Montserrat MS + +Morocco MA + +Mozambique MZ + +Myanmar MM + +Namibia NA + +Nauru NR + +Nepal NP + +Netherlands NL + +New +Caledonia NC + +New Zealand NZ + +Nicaragua NI + +Niger NE + +Nigeria NG + +Niue NU + +Norfolk Island NF + +Northern +Mariana +Islands MP + +Norway NO + +>< + +Oman OM + +Pakistan PK + +Palau PW + +Palestine PS + +Panama PA + +Papua New +Guinea PG + +Paraguay PY + +Peru PE + +Philippines PH + +Pitcairn PN + +Poland PL + +Portugal PT + +Puerto Rico PR + +Qatar QA + +Réunion RE + +Romania RO + +Russia RU + +Rwanda RW + +Saint +Barthélemy BL + +Saint Helena, +Ascension +and Tristan +da Cunha SH + +Saint Kitts +and Nevis KN + +Saint Lucia LC + +Saint Martin +(French part) MF + +Saint Pierre +and Miquelon PM + +Saint Vincent +and the +Grenadines VC + +Samoa WS + +San Marino SM + +Sao Tome +and Principe ST + +Saudi Arabia SA + +Senegal SN + +Serbia RS + +Seychelles SC + +Sierra Leone SL + +Singapore SG + +Sint Maarten +(Dutch part) SX + +Slovakia SK + +Slovenia SI + +Solomon +Islands SB + +Somalia SO + +South Africa ZA + +South +Georgia and +the South +Sandwich +Islands GS + +South Sudan SS + +Spain ES + +Sri Lanka LK + +Sudan SD + +Suriname SR + +Svalbard and +Jan Mayen SJ + +Swaziland SZ + +Sweden SE + +Switzerland CH + +Syrian Arab +Republic SY + +Taiwan TW + +Tajikistan TJ + +Tanzania, +United +Republic of TZ + +Thailand TH + +Timor-Leste TL + +Togo TG + +Tokelau TK + +Tonga TO + +Trinidad and +Tobago TT + +Tunisia TN + +Turkey TR + +Turkmenistan TM + +Turks and +Caicos +Islands TC + +Tuvalu TV + +Uganda UG + +Ukraine UA + +United Arab +Emirates AE + +United Kingdom GB + +United States US + +United States +Minor +Outlying +Islands UM + +Uruguay UY + +Uzbekistan UZ + +Vanuatu VU + +Venezuela VE + +Viet Nam VN + +Virgin Islands, +British VG + +Virgin Islands, +U.S. VI + +Wallis and +Futuna WF + +Western Sahara EH + +Yemen YE + +Zambia ZM + +Zimbabwe ZW +``` diff --git a/cmode-off.sh b/cmode-off.sh deleted file mode 100755 index 39fd8c5..0000000 --- a/cmode-off.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# 2021-12-18 -# -# Purpose: Turn Concurrent Mode off. -# -# To make this file executable: -# -# $ chmod +x edit-options.sh -# -# To execute this file: -# -# $ ./cmode-off.sh - -sed -i 's/CONFIG_CONCURRENT_MODE = y/CONFIG_CONCURRENT_MODE = n/g' Makefile -RESULT=$? - -if [[ "$RESULT" != "0" ]]; then - echo "An error occurred and Concurrent Mode was not turned off in Makefile." - exit 1 -else - echo "Concurrent Mode was turned off in Makefile as planned." -fi diff --git a/cmode-on.sh b/cmode-on.sh deleted file mode 100755 index 79938a5..0000000 --- a/cmode-on.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# 2021-12-03 -# -# Purpose: Turn Concurrent Mode on. -# -# To make this file executable: -# -# $ chmod +x edit-options.sh -# -# To execute this file: -# -# $ ./cmode-on.sh - -sed -i 's/CONFIG_CONCURRENT_MODE = n/CONFIG_CONCURRENT_MODE = y/g' Makefile -RESULT=$? - -if [[ "$RESULT" != "0" ]]; then - echo "An error occurred and Concurrent Mode was not turned on in Makefile." - exit 1 -else - echo "Concurrent Mode was turned on in Makefile as planned." -fi diff --git a/docs/Update_wpa_supplicant_v3a.md b/docs/Update_wpa_supplicant_v3a.md deleted file mode 100644 index e18866f..0000000 --- a/docs/Update_wpa_supplicant_v3a.md +++ /dev/null @@ -1,169 +0,0 @@ -2022-02-14 - -How to Upgrade wpa_supplicant - -Tested on: Linux Mint 20.2 - kernel 5.13 - -Info: Some distros may require additional updates beyond wpa_supplicant -to support WPA3 in managed (client) mode. Hopefully, as time passes, -making modifications will no longer be necessary for the Realtek -drivers to fully support WPA3. No modifications, such as this, are -necessary at this time for AP mode with the Raspberry Pi OS. - -Note: This document applies only to the following drivers: - -``` -https://github.com/morrownr/8821au-20210708 -https://github.com/morrownr/8812au-20210629 -https://github.com/morrownr/88x2bu-20210702 -https://github.com/morrownr/8821cu-20210118 -``` - -Purpose: Provide instructions for upgrading wpa_supplicant. As of the -date of this document, the specified Realtek USB WiFi adapter drivers -cannot support WPA3 without a very new version of wpa_supplicant -installed on most Linux distros. The version of wpa_supplicant required -currently is not even released yet. It is the git main. - -This guide and its effectiveness has had limited testing but has been -requested by users. It is now up to you, should you decide this is what -want to do, to report success or failure so that we can improve this -guide. - -Disclaimer: This guide attempts to help you install software that has -not been released. This may break your system. If it does break your -system, you own it. - - -Step 1) Install dependencies required by wpa_supplicant. - -``` -$ sudo apt install -y libssl-dev build-essential pkg-config libnl-3-dev - -$ sudo apt install -y libdbus-1-dev libdbus-glib-1-2 libdbus-glib-1-dev - -$ sudo apt install -y libreadline-dev libncurses5-dev libnl-genl-3-dev - -$ sudo apt install -y dbus libnl-route-3-dev -``` - -Step 2) Go to the `src` directory. - -``` -$ cd ~/src -``` - -The `~/src` directory has already been created if you followed the -instructions for installing any of the wifi drivers listed above. - - -3) Download the wpa_supplicant source package. - -``` -$ git clone git://w1.fi/hostap.git -``` - -4) Go in to wpa_supplicant folder. - -``` -$ cd ~/src/hostap/wpa_supplicant -``` - -If an error is returned, check whether the directory name is correct. - - -5) Create a build configuration file. - -``` -$ sudo nano .config -``` - -Add the following contents into .config and save ( Ctrl + X, Y, Enter ) - -``` -# 2021-11.29 -# .config for wpa_supplicant -# Required for WPA3 -CONFIG_TLS=openssl -CONFIG_IEEE80211W=y -CONFIG_SAE=y -CONFIG_LIBNL20=y -CONFIG_LIBNL32=y -# -# Defaults per defconfig -CONFIG_DRIVER_WEXT=y -CONFIG_DRIVER_NL80211=y -CONFIG_DRIVER_WIRED=y -CONFIG_DRIVER_MACSEC_LINUX=y -CONFIG_IEEE8021X_EAPOL=y -CONFIG_EAP_MD5=y -CONFIG_EAP_MSCHAPV2=y -CONFIG_EAP_TLS=y -CONFIG_EAP_PEAP=y -CONFIG_EAP_TTLS=y -CONFIG_EAP_FAST=y -CONFIG_EAP_GTC=y -CONFIG_EAP_OTP=y -CONFIG_EAP_PWD=y -CONFIG_EAP_PAX=y -CONFIG_EAP_LEAP=y -CONFIG_EAP_SAKE=y -CONFIG_EAP_GPSK=y -CONFIG_EAP_GPSK_SHA256=y -CONFIG_EAP_TNC=y -CONFIG_WPS=y -CONFIG_EAP_IKEV2=y -CONFIG_MACSEC=y -CONFIG_PKCS12=y -CONFIG_SMARTCARD=y -CONFIG_BACKEND=file -CONFIG_CTRL_IFACE=y -CONFIG_CTRL_IFACE_DBUS_NEW=y -CONFIG_CTRL_IFACE_DBUS_INTRO=y -CONFIG_IEEE80211R=y -CONFIG_DEBUG_FILE=y -CONFIG_DEBUG_SYSLOG=y -CONFIG_IEEE80211AC=y -CONFIG_INTERWORKING=y -CONFIG_HS20=y -CONFIG_AP=y -CONFIG_P2P=y -CONFIG_TDLS=y -CONFIG_WIFI_DISPLAY=y -CONFIG_DPP=y -# -# Not defaults per defconfig -CONFIG_READLINE=y -CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON -# -# Extra -CFLAGS += -I/usr/include/libnl3 -# -# End of .config -``` - -6) Compile - -``` -$ make -``` - -7) Install - -``` -$ sudo make install -``` - -8) Reboot - -``` -$ sudo reboot -``` - -9) Check version - -``` -$ wpa_supplicant -v -``` - ------ diff --git a/install-driver.sh b/install-driver.sh index 1fcf1ba..dddfe18 100755 --- a/install-driver.sh +++ b/install-driver.sh @@ -4,11 +4,21 @@ # # Supports dkms and non-dkms installations. +# Copyright(c) 2022 Nick Morrow +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + SCRIPT_NAME="install-driver.sh" -SCRIPT_VERSION="20221205" +SCRIPT_VERSION="20221218" MODULE_NAME="88x2bu" DRV_VERSION="5.13.1" -OPTIONS_FILE="${MODULE_NAME}.conf" KVER="$(uname -r)" KARCH="$(uname -m)" @@ -17,11 +27,7 @@ MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" DRV_NAME="rtl${MODULE_NAME}" DRV_DIR="$(pwd)" - -# Some distros have a non-mainlined, patched-in kernel driver -# that has to be deactivated. The filename may need to change -# when the new in-kernel driver is mainlined. -BLACKLIST_FILE="rtw88_8822bu.conf" +OPTIONS_FILE="${MODULE_NAME}.conf" # check to ensure sudo was used if [[ $EUID -ne 0 ]] @@ -31,6 +37,37 @@ then exit 1 fi +# ensure /usr/sbin is in the PATH so iw can be found +if ! echo "$PATH" | grep -qw sbin; then + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +fi + +# check to ensure gcc is installed +if ! command -v gcc >/dev/null 2>&1 +then + echo "A required package appears to not be installed." + echo "Please install the following package: gcc" + echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" + exit 1 +fi + +# check to ensure make is installed +if ! command -v make >/dev/null 2>&1 +then + echo "A required package appears to not be installed." + echo "Please install the following package: make" + echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" + exit 1 +fi + +# check to see if header files are installed +if [ ! -d "/lib/modules/$(uname -r)/build" ]; then + echo "Your kernel headers aren't properly installed." + echo "Please consult your distro documentation." + echo "Once the header files are installed, please run \"sudo ./${SCRIPT_NAME}\"" + exit 1 +fi + # check to ensure iw is installed if ! command -v iw >/dev/null 2>&1 then @@ -40,11 +77,11 @@ then exit 1 fi -# check to ensure mokutil is installed -if ! command -v mokutil >/dev/null 2>&1 +# check to ensure rfkill is installed +if ! command -v rfkill >/dev/null 2>&1 then echo "A required package appears to not be installed." - echo "Please install the following package: mokutil" + echo "Please install the following package: rfkill" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 fi @@ -58,15 +95,6 @@ then exit 1 fi -# check to ensure rfkill is installed -if ! command -v rfkill >/dev/null 2>&1 -then - echo "A required package appears to not be installed." - echo "Please install the following package: rfkill" - echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - # support for the NoPrompt option allows non-interactive use of this script NO_PROMPT=0 @@ -97,6 +125,18 @@ then /sbin/depmod -a ${KVER} fi +# check for existing dkms installations of any version of this driver +if command -v dkms >/dev/null 2>&1 +then + if dkms status | grep -i ${DRV_NAME}; then + echo "The above driver needs to be removed before the installation can be successfull." + echo "Example: $ sudo dkms remove ${DRV_NAME}/X.X.X.X --all" + echo "Please replace X.X.X.X by the driver version number shown above." + echo "Once the driver is removed, please run \"sudo ./${SCRIPT_NAME}\"" + exit 1 + fi +fi + # information that helps with bug reports # display kernel version @@ -110,18 +150,23 @@ gcc_ver=$(gcc --version | grep -i gcc) echo "gcc --version="${gcc_ver} # display ISO 3166-1 alpha-2 Country Code -# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 a2_country_code=$(iw reg get | grep -i country) -echo "Country Code=="${a2_country_code} +echo "Country Code="${a2_country_code} +if [[ $a2_country_code == *"00"* ]]; +then + echo "The Country Code may not be properly set." + echo "File alpha-2_Country_Codes is located in the driver directory." + echo "Please read and follow the directions in the file." +fi -# check for secure mode -# +# display secure mode status +# run if mokutil is installed +if command -v mokutil >/dev/null 2>&1 +then + mokutil --sb-state +fi -# blacklist the in-kernel module (driver) so that there is no conflict -echo "Installing ${BLACKLIST_FILE} to: /etc/modprobe.d" -cp -f ${BLACKLIST_FILE} /etc/modprobe.d - -# sets module parameters (driver options) +# sets module parameters (driver options) and blacklisted modules echo "Installing ${OPTIONS_FILE} to: /etc/modprobe.d" cp -f ${OPTIONS_FILE} /etc/modprobe.d @@ -154,7 +199,7 @@ then if [[ "$RESULT" = "0" ]] then - make clean >/dev/null 2>&1 + make clean >/dev/null 2>&1 echo "The driver was installed successfully." else echo "An error occurred. Error = ${RESULT}" @@ -180,6 +225,7 @@ else then if [[ "$RESULT" = "3" ]] then + echo "This driver may already be installed." echo "Run the following and then reattempt installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -192,7 +238,7 @@ else exit $RESULT fi else - echo "The driver was added successfully." + echo "The driver was added to dkms successfully." fi dkms build -m ${DRV_NAME} -v ${DRV_VERSION} @@ -207,7 +253,7 @@ else echo "$ sudo ./remove-driver.sh" exit $RESULT else - echo "The driver was built successfully." + echo "The driver was built by dkms successfully." fi dkms install -m ${DRV_NAME} -v ${DRV_VERSION} @@ -222,7 +268,7 @@ else echo "$ sudo ./remove-driver.sh" exit $RESULT else - echo "The driver was installed successfully." + echo "The driver was installed by dkms successfully." fi fi diff --git a/remove-driver.sh b/remove-driver.sh index fda8b77..d7caff2 100755 --- a/remove-driver.sh +++ b/remove-driver.sh @@ -4,11 +4,21 @@ # # Supports dkms and non-dkms removals. +# Copyright(c) 2022 Nick Morrow +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + SCRIPT_NAME="remove-driver.sh" -SCRIPT_VERSION="20221204" +SCRIPT_VERSION="20221218" MODULE_NAME="88x2bu" DRV_VERSION="5.13.1" -OPTIONS_FILE="${MODULE_NAME}.conf" KVER="$(uname -r)" KARCH="$(uname -m)" @@ -17,10 +27,7 @@ MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" DRV_NAME="rtl${MODULE_NAME}" DRV_DIR="$(pwd)" - -# Some distros have a non-mainlined, patched-in kernel driver -# that has to be deactivated. -BLACKLIST_FILE="rtw88_8822bu.conf" +OPTIONS_FILE="${MODULE_NAME}.conf" # check to ensure sudo was used if [[ $EUID -ne 0 ]] @@ -62,10 +69,10 @@ fi # information that helps with bug reports -# kernel +# display kernel version echo "Linux Kernel=${KVER}" -# architecture - for ARM: aarch64 = 64 bit, armv7l = 32 bit +# display architecture echo "CPU Architecture=${KARCH}" # determine if dkms is installed and run the appropriate routines @@ -93,8 +100,6 @@ then fi fi -echo "Removing ${BLACKLIST_FILE} from /etc/modprobe.d" -rm -f /etc/modprobe.d/${BLACKLIST_FILE} echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d" rm -f /etc/modprobe.d/${OPTIONS_FILE} echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" diff --git a/rtw88_8822bu.conf b/rtw88_8822bu.conf deleted file mode 100644 index f28400c..0000000 --- a/rtw88_8822bu.conf +++ /dev/null @@ -1 +0,0 @@ -blacklist rtw88_8822bu diff --git a/start-mon.sh b/start-mon.sh deleted file mode 100755 index 4977d36..0000000 --- a/start-mon.sh +++ /dev/null @@ -1,304 +0,0 @@ -#!/bin/bash - -SCRIPT_NAME="start-mon.sh" -SCRIPT_VERSION="20220408" - - -# Purpose: Start and configure monitor mode on the provided interface - -# Usage: $ sudo ./start-mon.sh [interface:wlan0] - - -clear - - -# Check that sudo was used to start the script -if [[ $EUID -ne 0 ]] -then - echo - echo " ERROR: You must run this script with superuser (root) privileges." - echo -e " Try: sudo ./${SCRIPT_NAME} [interface:wlan0]" - echo - exit 1 -fi - - -# Add code to check if iw and ip are installed - - -# Ensure WiFi radio is not blocked -sudo rfkill unblock wlan - - -# Assign default monitor mode interface name -iface0mon='wlan0mon' - - -# Assign default channel -chan=6 - - -# Activate option to set automatic (1) or manual (2) interface mode -# -# Option 1: if you only have one wlan interface (automatic detection) -#iface0=`iw dev | grep 'Interface' | sed 's/Interface //'` -# -# Option 2: if you have more than one wlan interface (default wlan0) -iface0=${1:-wlan0} - - -# Set iface0 down -ip link set dev $iface0 down -# Check if iface0 exists and continue if true -if [ $? -eq 0 ] -then -# Disable interfering processes - PROCESSES="wpa_action\|wpa_supplicant\|wpa_cli\|dhclient\|ifplugd\|dhcdbd\|dhcpcd\|udhcpc\|NetworkManager\|knetworkmanager\|avahi-autoipd\|avahi-daemon\|wlassistant\|wifibox\|net_applet\|wicd-daemon\|wicd-client\|iwd" - unset match - match="$(ps -A -o comm= | grep ${PROCESSES} | grep -v grep | wc -l)" - badProcs=$(ps -A -o pid=PID -o comm=Name | grep "${PROCESSES}\|PID") - for pid in $(ps -A -o pid= -o comm= | grep ${PROCESSES} | awk '{print $1}'); do - command kill -19 "${pid}" # -19 = STOP - done - clear - echo - echo ' The following processes have been stopped:' - echo - echo "${badProcs}" - echo - echo ' Note: The above processes can be returned' - echo ' to a normal state at the end of this script.' - echo - read -p " Press any key to continue... " -n 1 -r - - -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0 info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0 info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0 | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0 info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - echo ' --------------------------------' - echo - - -# Set addr (has to be done before renaming the interface) - iface_addr_orig=$iface_addr - read -p " Do you want to set a new addr? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - read -p " What addr do you want? ( e.g. 12:34:56:78:90:ab ) " iface_addr -# need code to ID bad addresses - ip link set dev $iface0 address $iface_addr - fi - - -# Set monitor mode -# iw dev set monitor -# Valid monitor flags are: -# none: no special flags -# fcsfail: show frames with FCS errors -# control: show control frames -# otherbss: show frames from other BSSes -# cook: use cooked mode -# active: use active mode (ACK incoming unicast packets) -# mumimo-groupid : use MUMIMO according to a group id -# mumimo-follow-mac : use MUMIMO according to a MAC address - iw dev $iface0 set monitor none - - -# Rename interface - ip link set dev $iface0 name $iface0mon - - -# Bring the interface up - ip link set dev $iface0mon up - - -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - echo ' --------------------------------' - echo - - -# Set channel - read -p " Do you want to set the channel? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - read -p " What channel do you want to set? " chan -# Documentation: -# iw dev set channel [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] -# iw dev set freq [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] -# iw dev set freq [5|10|20|40|80|80+80|160] [ []] -# Select one or modify as required: - iw dev $iface0mon set channel $chan -# iw dev $iface0mon set channel $chan HT40- -# iw dev $iface0mon set channel $chan 80MHz -# To test if channel was set correctly: -# aireplay-ng --test - fi - - -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_chan=$(iw dev $iface0mon info | grep 'channel' | sed 's/channel //' | sed -e 's/^[ \t]*//') - echo ' chan - ' $chan - iface_txpw=$(iw dev $iface0mon info | grep 'txpower' | sed 's/txpower //' | sed -e 's/^[ \t]*//') - echo ' txpw - ' $iface_txpw - echo ' --------------------------------' - echo - - -# Set txpw - read -p " Do you want to set the txpower? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - echo " Note: Some USB WiFi adapters will not allow the txpw to be set." - read -p " What txpw setting do you want to attempt to set? ( e.g. 2300 = 23 dBm ) " iface_txpw - iw dev $iface0mon set txpower fixed $iface_txpw - fi - - -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - iface_chan=$(iw dev $iface0mon info | grep 'channel' | sed 's/channel //' | sed -e 's/^[ \t]*//') - echo ' chan - ' $chan - iface_txpw=$(iw dev $iface0mon info | grep 'txpower' | sed 's/txpower //' | sed -e 's/^[ \t]*//') - echo ' txpw - ' $iface_txpw - echo ' --------------------------------' - echo - - -# Interface ready - echo " The Interface is now ready for Monitor Mode use." - echo - echo " You can place this terminal in the background" - echo " while you run any applications you wish to run." - echo - read -p " Press any key to continue... " -n 1 -r - echo - - -# Return the adapter to original settings or not - read -p " Do you want to return the adapter to original settings? [Y/n] " -n 1 -r - if [[ $REPLY =~ ^[Nn]$ ]] - then -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0mon info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0mon info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0mon | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0mon info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - echo ' --------------------------------' - echo - exit 0 - else - ip link set dev $iface0mon down - ip link set dev $iface0mon address $iface_addr_orig - iw $iface0mon set type managed - ip link set dev $iface0mon name $iface0 - ip link set dev $iface0 up -# Enable interfering processes - for pid in $(ps -A -o pid= -o comm= | grep ${PROCESSES} | awk '{print $1}'); do - command kill -18 "${pid}" # -18 = CONT - done -# Display interface settings - clear - echo - echo ' --------------------------------' - echo -e " ${SCRIPT_NAME} ${SCRIPT_VERSION}" - echo ' --------------------------------' - echo ' WiFi Interface:' - echo ' '$iface0 - echo ' --------------------------------' - iface_name=$(iw dev $iface0 info | grep 'Interface' | sed 's/Interface //' | sed -e 's/^[ \t]*//') - echo ' name - ' $iface_name - iface_type=$(iw dev $iface0 info | grep 'type' | sed 's/type //' | sed -e 's/^[ \t]*//') - echo ' type - ' $iface_type - iface_state=$(ip addr show $iface0 | grep 'state' | sed 's/.*state \([^ ]*\)[ ]*.*/\1/') - echo ' state - ' $iface_state - iface_addr=$(iw dev $iface0 info | grep 'addr' | sed 's/addr //' | sed -e 's/^[ \t]*//') - echo ' addr - ' $iface_addr - echo ' --------------------------------' - echo - exit 0 - fi -else - clear - echo - echo " ERROR: Please provide an existing interface as parameter!" - echo -e " Usage: $ sudo ./$SCRIPT_NAME [interface:wlan0]" - echo " Tip: $ iw dev" - echo - exit 1 -fi