From bcfd5dcc9f1804562ddb5a174b34aa37cef535d4 Mon Sep 17 00:00:00 2001 From: morrownr Date: Fri, 30 Dec 2022 15:14:47 -0600 Subject: [PATCH] various updates --- 88x2bu.conf | 12 +++--- Makefile | 7 ++-- README.md | 16 +++---- alpha-2_Country_Codes | 67 ++++++++++++++---------------- docs/Concurrent_Mode.md | 17 +++++--- include/autoconf.h | 3 +- install-driver.sh | 92 ++++++++++++++++++++++++++--------------- remove-driver.sh | 37 +++++++++++++---- 8 files changed, 148 insertions(+), 103 deletions(-) diff --git a/88x2bu.conf b/88x2bu.conf index f8dc6a2..8814a69 100644 --- a/88x2bu.conf +++ b/88x2bu.conf @@ -68,11 +68,11 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_us # # Beamforming options ( rtw_beamform_cap ) # -# 0 = Disable (default) +# 0 = Disable # 1 = SU Beamformer # 2 = SU Beamformee # 3 = SU Beamformer and SU Beamformee -# 10= SU Beamformee and MU Beamformee +# 10= SU Beamformee and MU Beamformee (default) # 11= SU Beamformer and SU Beamformee and MU Beamformee # # Note: MU Beamformer is not supported. @@ -91,7 +91,7 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_us # Example for Taiwan: rtw_country_code=TW # # ISO 3166-1 alpha-2 codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 -# +# # ----- # # DFS Options ( rtw_dfs_region_domain ) @@ -115,7 +115,7 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_us # Select P2P interface in concurrent mode ( rtw_sel_p2p_iface ) # # 0 = Sets interface 0 to be p2p interface -# 1 = Sets interface 1 to be p2p interface (default) +# 1 = Sets interface 1 to be p2p interface (default) # # ----- # @@ -146,8 +146,8 @@ options 88x2bu rtw_drv_log_level=0 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_us # observed on the Raspberry Pi 4B with both the 32 and 64 bit versions of the # Raspberry Pi OS. This problem appears to be specific to the Raspberry Pi 4B # and adapters based on the rtl8812bu chipset. -# -# +# +# # ----- # # To see all options that are available: diff --git a/Makefile b/Makefile index 39b818f..1af157a 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,6 @@ CONFIG_GSPI_HCI = n CONFIG_AP_MODE = y CONFIG_P2P = y CONFIG_MP_INCLUDED = n -CONFIG_CONCURRENT_MODE = n CONFIG_POWER_SAVING = y CONFIG_IPS_MODE = default CONFIG_LPS_MODE = default @@ -83,7 +82,7 @@ CONFIG_USB_AUTOSUSPEND = n CONFIG_HW_PWRP_DETECTION = n CONFIG_BT_COEXIST = y CONFIG_WAPI_SUPPORT = n -CONFIG_EFUSE_CONFIG_FILE = y +CONFIG_EFUSE_CONFIG_FILE = n CONFIG_EXT_CLK = n CONFIG_TRAFFIC_PROTECT = n CONFIG_LOAD_PHY_PARA_FROM_FILE = y @@ -99,7 +98,7 @@ CONFIG_SIGNAL_SCALE_MAPPING = n CONFIG_80211W = y CONFIG_REDUCE_TX_CPU_LOADING = n CONFIG_BR_EXT = y -CONFIG_TDLS = n +CONFIG_TDLS = y CONFIG_WIFI_MONITOR = y CONFIG_MCC_MODE = n CONFIG_APPEND_VENDOR_IE_ENABLE = n @@ -1394,7 +1393,7 @@ EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ARCH ?= $(SUBARCH) CROSS_COMPILE ?= -KVER := $(shell uname -r) +KVER := $(shell uname -r) KSRC := /lib/modules/$(KVER)/build MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/ INSTALL_PREFIX := diff --git a/README.md b/README.md index bbf2736..426819d 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ confirm that this is the correct driver for your adapter. ### Compatible Kernels - Kernels: 4.19 - 5.11 (Realtek) -- Kernels: 5.12 - 6.1 (community support) +- Kernels: 5.12 - 6.2 (community support) ### Tested Compilers @@ -81,7 +81,7 @@ be provided via PR or message in Issues. - SkiffOS for Odroid XU4 (ARM 32 bit) (kernel 6.0.7) -- Ubuntu 22.04 (kernel 5.15) and 22.10 (kernel 5.19) +- Ubuntu 22.04 (kernel 5.15) and 22.10 (kernel 5.19) (kernel 6.2 rc1) - Void Linux (kernel 5.18) @@ -90,10 +90,10 @@ 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). +Note: Android is supported in the driver according to Realtek. 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 @@ -120,7 +120,7 @@ or two to the Makefile). ### Compatible Devices -Warning: If you are looking for information about what adapter to buy, +Note: 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. @@ -217,7 +217,7 @@ If it is not set, you will likely have problems accessing some channels, especia 5 Ghz and 6 GHz channels. To set your Country Code: ``` -iw reg set US +sudo iw reg set US ``` If you are not in the US, please use the country code for your country. See: diff --git a/alpha-2_Country_Codes b/alpha-2_Country_Codes index c9036ae..e2d43e3 100644 --- a/alpha-2_Country_Codes +++ b/alpha-2_Country_Codes @@ -1,4 +1,4 @@ -2022-12-18 +2022-12-26 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 @@ -23,30 +23,27 @@ iw reg get ``` ISO 3166-1 alpha-2 Country Codes -Name Code +Code Name -Afghanistan AF +AF Afghanistan -Aland -Islands AX +AX Aland Islands -Albania AL +AL Albania -Algeria DZ +DZ Algeria -American -Samoa AS +AS American Samoa -Andorra AD +AD Andorra -Angola AO +AO Angola -Anguilla AI +AI Anguilla -Antarctica AQ +AQ Antarctica -Antigua and -Barbuda AG +AG Antigua and Barbuda Argentina AR @@ -321,7 +318,7 @@ Liberia LR Libya LY -Liechtenstein LI +LI Liechtenstein Lithuania LT @@ -401,7 +398,7 @@ Nigeria NG Niue NU -Norfolk Island NF +NF Norfolk Island Northern Mariana @@ -461,11 +458,9 @@ and Nevis KN Saint Lucia LC -Saint Martin -(French part) MF +MF Saint Martin (French part) -Saint Pierre -and Miquelon PM +PM Saint Pierre and Miquelon Saint Vincent and the @@ -475,10 +470,9 @@ Samoa WS San Marino SM -Sao Tome -and Principe ST +ST Sao Tome and Principe -Saudi Arabia SA +SA Saudi Arabia Senegal SN @@ -486,12 +480,11 @@ Serbia RS Seychelles SC -Sierra Leone SL +SL Sierra Leone Singapore SG -Sint Maarten -(Dutch part) SX +SX Sint Maarten (Dutch part) Slovakia SK @@ -502,7 +495,7 @@ Islands SB Somalia SO -South Africa ZA +ZA South Africa South Georgia and @@ -557,7 +550,7 @@ Tunisia TN Turkey TR -Turkmenistan TM +TM Turkmenistan Turks and Caicos @@ -572,9 +565,9 @@ Ukraine UA United Arab Emirates AE -United Kingdom GB +GB United Kingdom -United States US +US United States United States Minor @@ -597,14 +590,14 @@ British VG Virgin Islands, U.S. VI -Wallis and -Futuna WF +WF Wallis and Futuna -Western Sahara EH +EH Western Sahara -Yemen YE +YE Yemen -Zambia ZM +ZM Zambia + +ZW Zimbabwe -Zimbabwe ZW ``` diff --git a/docs/Concurrent_Mode.md b/docs/Concurrent_Mode.md index 8720efd..1e976f8 100644 --- a/docs/Concurrent_Mode.md +++ b/docs/Concurrent_Mode.md @@ -1,4 +1,4 @@ -2022-11-15 +2022-12-27 What is Concurrent Mode? @@ -10,7 +10,7 @@ single WiFi adapter. For example: -Use station mode (called managed or client mode also) to connect with an +Use station mode (also called managed or client mode) to connect with an AP to access the internet at the same time as it also performs as an AP to allow other devices to connect to the second interface. @@ -35,13 +35,13 @@ nano Makefile Change the following line: ``` -CONFIG_CONCURRENT_MODE = n +#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE ``` to ``` -CONFIG_CONCURRENT_MODE = y +EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE ``` and then install the driver per the installation steps. If @@ -50,10 +50,15 @@ the driver is already installed, run the following first: ``` sudo ./remove-driver.sh ``` +and then reinstall the driver with: + +``` +sudo ./install-driver.sh +``` Once the driver is fully installed and you have rebooted the system, you -can verify that this works by typing the “iw dev” command, You should -see two wireless interfaces, and the MAC address of secondary interface +can verify that this works by typing the “iw dev” command. You should +see two wireless interfaces, and the MAC address of the secondary interface is nearly the same as the first except for one digit. ----- diff --git a/include/autoconf.h b/include/autoconf.h index 7137b4f..299fc8e 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -42,7 +42,8 @@ #endif #ifdef CONFIG_80211AC_VHT - #define CONFIG_BEAMFORMING +/* nrm - activates beamforming */ + /* #define CONFIG_BEAMFORMING */ #endif /* set CONFIG_IOCTL_CFG80211 from Makefile */ diff --git a/install-driver.sh b/install-driver.sh index dddfe18..952d325 100755 --- a/install-driver.sh +++ b/install-driver.sh @@ -16,7 +16,7 @@ # GNU General Public License for more details. SCRIPT_NAME="install-driver.sh" -SCRIPT_VERSION="20221218" +SCRIPT_VERSION="20221228" MODULE_NAME="88x2bu" DRV_VERSION="5.13.1" @@ -45,7 +45,7 @@ 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 "A required package is not installed." echo "Please install the following package: gcc" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -54,7 +54,7 @@ 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 "A required package is not installed." echo "Please install the following package: make" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -62,7 +62,7 @@ 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 "Your kernel header files aren't properly installed." echo "Please consult your distro documentation." echo "Once the header files are installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -71,7 +71,7 @@ fi # check to ensure iw is installed if ! command -v iw >/dev/null 2>&1 then - echo "A required package appears to not be installed." + echo "A required package is not installed." echo "Please install the following package: iw" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -80,7 +80,7 @@ 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 "A required package is not installed." echo "Please install the following package: rfkill" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -89,7 +89,7 @@ fi # check to ensure nano is installed if ! command -v nano >/dev/null 2>&1 then - echo "A required package appears to not be installed." + echo "A required package is not installed." echo "Please install the following package: nano" echo "Once the package is installed, please run \"sudo ./${SCRIPT_NAME}\"" exit 1 @@ -115,16 +115,37 @@ do done # displays script name and version -echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" +echo "Script: ${SCRIPT_NAME} version ${SCRIPT_VERSION}" -# check for and remove non-dkms installation +# check for and remove non-dkms installations +# standard naming if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]] then - echo "Removing a non-dkms installation." + echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko" rm -f ${MODDESTDIR}${MODULE_NAME}.ko /sbin/depmod -a ${KVER} fi +# check for and remove non-dkms installations +# with rtl added to module name (PClinuxOS) +if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]] +then + echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko" + rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko + /sbin/depmod -a ${KVER} +fi + +# check for and remove non-dkms installations +# with compressed module in a unique non-standard location (Armbian) +# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz +# Dear Armbiam, this is a really bad idea. +if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]] +then + echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" + rm -f /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz + /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 @@ -140,23 +161,23 @@ fi # information that helps with bug reports # display kernel version -echo "Linux Kernel=${KVER}" +echo "Kernel: ${KVER}" # display architecture -echo "CPU Architecture=${KARCH}" +echo "Arch: ${KARCH}" # display gcc version gcc_ver=$(gcc --version | grep -i gcc) -echo "gcc --version="${gcc_ver} +echo "gcc: "${gcc_ver} # display ISO 3166-1 alpha-2 Country Code a2_country_code=$(iw reg get | grep -i country) -echo "Country Code="${a2_country_code} +echo "Country: "${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." + echo "Please read and follow the directions in the file after installation." fi # display secure mode status @@ -167,7 +188,7 @@ then fi # sets module parameters (driver options) and blacklisted modules -echo "Installing ${OPTIONS_FILE} to: /etc/modprobe.d" +echo "Installing ${OPTIONS_FILE} to /etc/modprobe.d" cp -f ${OPTIONS_FILE} /etc/modprobe.d # determine if dkms is installed and run the appropriate routines @@ -177,14 +198,14 @@ then make clean >/dev/null 2>&1 - make + make -j$(nproc) RESULT=$? if [[ "$RESULT" != "0" ]] then - echo "An error occurred. Error = ${RESULT}" + echo "An error occurred: ${RESULT}" echo "Please report this error." - echo "Please copy all screen output and paste it into the report." + echo "Please copy all screen output and paste it into the problem report." echo "You will need to run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -202,9 +223,9 @@ then make clean >/dev/null 2>&1 echo "The driver was installed successfully." else - echo "An error occurred. Error = ${RESULT}" + echo "An error occurred: ${RESULT}" echo "Please report this error." - echo "Please copy all screen output and paste it into the report." + echo "Please copy all screen output and paste it into the problem report." echo "You will need to run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -213,9 +234,9 @@ else echo "The dkms installation routines are in use." # the dkms add command requires source in /usr/src/${DRV_NAME}-${DRV_VERSION} - echo "Copying source files to: /usr/src/${DRV_NAME}-${DRV_VERSION}" + echo "Copying source files to /usr/src/${DRV_NAME}-${DRV_VERSION}" cp -rf "${DRV_DIR}" /usr/src/${DRV_NAME}-${DRV_VERSION} - + dkms add -m ${DRV_NAME} -v ${DRV_VERSION} RESULT=$? @@ -228,11 +249,11 @@ else echo "This driver may already be installed." echo "Run the following and then reattempt installation." echo "$ sudo ./remove-driver.sh" - exit $RESULT + exit $RESULT else - echo "An error occurred. dkms add error = ${RESULT}" + echo "An error occurred. dkms add error: ${RESULT}" echo "Please report this error." - echo "Please copy all screen output and paste it into the report." + echo "Please copy all screen output and paste it into the problem report." echo "Run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -241,14 +262,19 @@ else echo "The driver was added to dkms successfully." fi - dkms build -m ${DRV_NAME} -v ${DRV_VERSION} + if command -v /usr/bin/time >/dev/null 2>&1 + then + /usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION} + else + dkms build -m ${DRV_NAME} -v ${DRV_VERSION} + fi RESULT=$? if [[ "$RESULT" != "0" ]] then - echo "An error occurred. dkms build error = ${RESULT}" + echo "An error occurred. dkms build error: ${RESULT}" echo "Please report this error." - echo "Please copy all screen output and paste it into the report." + echo "Please copy all screen output and paste it into the problem report." echo "Run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -261,9 +287,9 @@ else if [[ "$RESULT" != "0" ]] then - echo "An error occurred. dkms install error = ${RESULT}" + echo "An error occurred. dkms install error: ${RESULT}" echo "Please report this error." - echo "Please copy all screen output and paste it into the report." + echo "Please copy all screen output and paste it into the problem report." echo "Run the following before reattempting installation." echo "$ sudo ./remove-driver.sh" exit $RESULT @@ -277,10 +303,10 @@ if command -v rfkill >/dev/null 2>&1 then rfkill unblock wlan else - echo "Unable to run $ rfkill unblock wlan" + echo "Unable to run $ rfkill unblock wlan" fi -# if NoPrompt is not used, ask user some questions to complete installation +# if NoPrompt is not used, ask user some questions if [ $NO_PROMPT -ne 1 ] then read -p "Do you want to edit the driver options file now? [y/N] " -n 1 -r diff --git a/remove-driver.sh b/remove-driver.sh index d7caff2..eca53f5 100755 --- a/remove-driver.sh +++ b/remove-driver.sh @@ -16,7 +16,7 @@ # GNU General Public License for more details. SCRIPT_NAME="remove-driver.sh" -SCRIPT_VERSION="20221218" +SCRIPT_VERSION="20221228" MODULE_NAME="88x2bu" DRV_VERSION="5.13.1" @@ -57,23 +57,44 @@ do done # displays script name and version -echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" +echo "Script: ${SCRIPT_NAME} version ${SCRIPT_VERSION}" -# check for and remove non-dkms installation +# check for and remove non-dkms installations +# standard naming if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]] then - echo "Removing a non-dkms installation." + echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko" rm -f ${MODDESTDIR}${MODULE_NAME}.ko /sbin/depmod -a ${KVER} fi +# check for and remove non-dkms installations +# with rtl added to module name (PClinuxOS) +if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]] +then + echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko" + rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko + /sbin/depmod -a ${KVER} +fi + +# check for and remove non-dkms installations +# with compressed module in a unique non-standard location (Armbian) +# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz +# Dear Armbiam, this is a really bad idea. +if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]] +then + echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" + rm -f /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz + /sbin/depmod -a ${KVER} +fi + # information that helps with bug reports # display kernel version -echo "Linux Kernel=${KVER}" +echo "Kernel: ${KVER}" # display architecture -echo "CPU Architecture=${KARCH}" +echo "Arch: ${KARCH}" # determine if dkms is installed and run the appropriate routines if command -v dkms >/dev/null 2>&1 @@ -94,7 +115,7 @@ then echo "${DRV_NAME}/${DRV_VERSION} has been removed" fi else - echo "An error occurred. dkms remove error = ${RESULT}" + echo "An error occurred. dkms remove error: ${RESULT}" echo "Please report this error." exit $RESULT fi @@ -108,7 +129,7 @@ make clean >/dev/null 2>&1 echo "The driver was removed successfully." echo "You may now delete the driver directory if desired." -# if NoPrompt is not used, ask user some questions to complete removal +# if NoPrompt is not used, ask user some questions if [ $NO_PROMPT -ne 1 ] then read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r