diff --git a/README.md b/README.md index 54db165..b57d2d3 100644 --- a/README.md +++ b/README.md @@ -379,27 +379,19 @@ 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 or install-driver-no-dkms.sh ) +#### Step 10: Run the installation script ( install-driver.sh ) Note: For automated builds (non-interactive), use _NoPrompt_ as an option. -Option for distros that support `dkms` (almost all) - ``` sudo ./install-driver.sh ``` -Option for distros that do not support `dkms` - -``` -sudo ./install-driver-no-dkms.sh -``` - 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. -Manual build instructions: The above scripts automate the installation +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: @@ -410,9 +402,8 @@ sudo make install sudo reboot ``` -Note: If you use the manual build instructions or the `install-driver-no-dkms.sh` -script, you will need to repeat the process each time a new kernel is -installed in your distro. +Note: If you use the manual build instructions script, you will need +to repeat the process each time a new kernel is installed in your distro. ----- @@ -629,19 +620,6 @@ present what you know to the devs of your distro via their problem reporting system. Turning off secure boot is NOT a fix. A real fix needs to happen. - ------ - -Question: Are there any known problems with AP mode? - -Answer: Overall this driver does a good job with AP mode. During testing -and work prior to making this driver available, the team working on this -driver noticed some problems in AP mode if used with a Raspberry Pi 4B. -We were unable to discover or fix the exact cause of the problem but -the workaround is to keep the driver in USB2 mode. This workaround only -applies to AP mode with Raspberry Pi 4B. No problems were noted with -systems that use x86 or amd64 processors. - ----- Question: Can you provide additional information about monitor mode? @@ -670,6 +648,17 @@ ALFA AWUS036ACS - [driver](https://github.com/morrownr/8821au-20210708) To ask questions, go to [USB-WiFi](https://github.com/morrownr/USB-WiFi) and post in `Discussions` or `Issues`. +----- +Question: Are there any known problems with AP mode? + +Answer: Overall this driver does a good job with AP mode. During testing +and work prior to making this driver available, the team working on this +driver noticed some problems in AP mode if used with a Raspberry Pi 4B. +We were unable to discover or fix the exact cause of the problem but +the workaround is to keep the driver in USB2 mode. This workaround only +applies to AP mode with Raspberry Pi 4B. No problems were noted with +systems that use x86 or amd64 processors. ----- + diff --git a/install-driver-no-dkms.sh b/install-driver-no-dkms.sh deleted file mode 100755 index eac63b8..0000000 --- a/install-driver-no-dkms.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# Purpose: Install Realtek USB WiFi adapter drivers. -# -# This version of the installation script does not use dkms. - -SCRIPT_NAME="install-driver-no-dkms.sh" -SCRIPT_VERSION="20220913" -OPTIONS_FILE="88x2bu.conf" - -MODULE_NAME="88x2bu" -KVER="$(uname -r)" -KSRC="/lib/modules/${KVER}/build" -MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" - -# Some distros have a non-mainlined, patched-in kernel driver -# that has to be deactivated. -BLACKLIST_FILE="rtw88_8822bu.conf" - -# support for NoPrompt allows non-interactive use of this script -NO_PROMPT=0 - -# get the options -while [ $# -gt 0 ] -do - case $1 in - NoPrompt) - NO_PROMPT=1 ;; - *h|*help|*) - echo "Syntax $0 " - echo " NoPrompt - noninteractive mode" - echo " -h|--help - Show help" - exit 1 - ;; - esac - shift -done - -# check to ensure sudo was used -if [[ $EUID -ne 0 ]] -then - echo "You must run this script with superuser (root) privileges." - echo "Try: \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - -# displays script name and version -echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" - -# information that helps with bug reports -# kernel -uname -r -# architecture - for ARM: aarch64 = 64 bit, armv7l = 32 bit -uname -m -#getconf LONG_BIT (need to work on this) - -echo "Installing the following driver..." -echo "${MODDESTDIR}${MODULE_NAME}.ko" - -# sets module parameters (driver options) -echo "Copying ${OPTIONS_FILE} to: /etc/modprobe.d" -cp -f ${OPTIONS_FILE} /etc/modprobe.d - -# blacklist the in-kernel module (driver) so that there is no conflict -echo "Copying ${BLACKLIST_FILE} to: /etc/modprobe.d" -cp -f ${BLACKLIST_FILE} /etc/modprobe.d - -make clean - -make -RESULT=$? - -if [[ "$RESULT" != "0" ]] -then - echo "An error occurred. Error = ${RESULT}" - echo "Please report this error." - echo "Please copy all screen output and paste it into the report." - echo "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver-no-dkms.sh" - exit $RESULT -fi - -# As shown in Makefile -# install: -# install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR) -# /sbin/depmod -a ${KVER} - -make install -RESULT=$? - -if [[ ("$RESULT" = "0")]] -then - echo "The driver was installed successfully." - # unblock wifi - rfkill unblock wlan -else - echo "An error occurred. Error = ${RESULT}" - echo "Please report this error." - echo "Please copy all screen output and paste it into the report." - echo "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver-no-dkms.sh" - exit $RESULT -fi - -# if NoPrompt is not used, ask user some questions to complete installation -if [ $NO_PROMPT -ne 1 ] -then - read -p "Do you want to edit the driver options file now? [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - nano /etc/modprobe.d/${OPTIONS_FILE} - fi - - read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - reboot - fi -fi - -exit 0 diff --git a/install-driver.sh b/install-driver.sh index abaf178..099ade5 100755 --- a/install-driver.sh +++ b/install-driver.sh @@ -1,24 +1,37 @@ #!/bin/bash -# Purpose: Install Realtek USB WiFi adapter drivers. +# Purpose: Install Realtek out-of-kernel USB WiFi adapter drivers. # -# This version of the installation script uses dkms. +# Supports dkms and non-dkms installations. SCRIPT_NAME="install-driver.sh" -SCRIPT_VERSION="20220821" +SCRIPT_VERSION="20220929" OPTIONS_FILE="88x2bu.conf" + +# Some distros have a non-mainlined, patched-in kernel driver +# that has to be deactivated. BLACKLIST_FILE="rtw88_8822bu.conf" +MODULE_NAME="88x2bu" +KVER="$(uname -r)" +MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" + DRV_NAME="rtl88x2bu" DRV_VERSION="5.13.1" - DRV_DIR="$(pwd)" -KRNL_VERSION="$(uname -r)" -# support for NoPrompt allows non-interactive use of this script +# check to ensure sudo was used +if [[ $EUID -ne 0 ]] +then + echo "You must run this script with superuser (root) privileges." + echo "Try: \"sudo ./${SCRIPT_NAME}\"" + exit 1 +fi + +# support for the NoPrompt option allows non-interactive use of this script NO_PROMPT=0 -# get the options +# get the script options while [ $# -gt 0 ] do case $1 in @@ -34,89 +47,120 @@ do shift done -# check to ensure sudo was used -if [[ $EUID -ne 0 ]] -then - echo "You must run this script with superuser (root) privileges." - echo "Try: \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - -# check for previous installation -if [[ -d "/usr/src/${DRV_NAME}-${DRV_VERSION}" ]] -then - echo "It appears that this driver may already be installed." - echo "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver.sh" - exit 1 -fi - -# information that helps with bug reports - # displays script name and version echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" +# check for and remove previously installed non-dkms installation +if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]] +then + echo "Removing a non-dkms installation." + rm -f $(MODDESTDIR)$(MODULE_NAME).ko + /sbin/depmod -a ${KVER} +fi + +# information that helps with bug reports # kernel uname -r - # architecture - for ARM: aarch64 = 64 bit, armv7l = 32 bit uname -m echo "Starting installation..." -# the add command requires source in /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} +# blacklist the in-kernel module (driver) so that there is no conflict +echo "Copying ${BLACKLIST_FILE} to: /etc/modprobe.d" +cp -f ${BLACKLIST_FILE} /etc/modprobe.d # sets module parameters (driver options) echo "Copying ${OPTIONS_FILE} to: /etc/modprobe.d" cp -f ${OPTIONS_FILE} /etc/modprobe.d -# blacklist the in-kernel module (driver) so that there is no conflict -echo "Copying ${BLACKLIST_FILE} to: /etc/modprobe.d" -cp -f ${BLACKLIST_FILE} /etc/modprobe.d - -dkms add -m ${DRV_NAME} -v ${DRV_VERSION} -RESULT=$? - -if [[ "$RESULT" != "0" ]] +# determine if dkms is installed and run the appropriate routines +if ! command -v dkms >/dev/null 2>&1 then - 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 "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver.sh" - exit $RESULT + echo "The non-dkms installation routines are in use." + + make clean + + make + RESULT=$? + + if [[ "$RESULT" != "0" ]] + then + echo "An error occurred. Error = ${RESULT}" + echo "Please report this error." + echo "Please copy all screen output and paste it into the report." + echo "You will need to run the following before reattempting installation." + echo "$ sudo ./remove-driver-no-dkms.sh" + exit $RESULT + fi + +# As shown in Makefile +# install: +# install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR) +# /sbin/depmod -a ${KVER} + make install + RESULT=$? + + if [[ "$RESULT" = "0" ]] + then + echo "The driver was installed successfully." + else + echo "An error occurred. Error = ${RESULT}" + echo "Please report this error." + echo "Please copy all screen output and paste it into the report." + echo "You will need to run the following before reattempting installation." + echo "$ sudo ./remove-driver-no-dkms.sh" + exit $RESULT + fi +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}" + cp -rf "${DRV_DIR}" /usr/src/${DRV_NAME}-${DRV_VERSION} + + dkms add -m ${DRV_NAME} -v ${DRV_VERSION} + RESULT=$? + + if [[ "$RESULT" != "0" ]] + then + 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 "Run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" + exit $RESULT + fi + + dkms build -m ${DRV_NAME} -v ${DRV_VERSION} + RESULT=$? + + if [[ "$RESULT" != "0" ]] + then + 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 "Run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" + exit $RESULT + fi + + dkms install -m ${DRV_NAME} -v ${DRV_VERSION} + RESULT=$? + + if [[ "$RESULT" = "0" ]] + then + echo "The driver was installed successfully." + else + 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 "Run the following before reattempting installation." + echo "$ sudo ./remove-driver.sh" + exit $RESULT + fi fi -dkms build -m ${DRV_NAME} -v ${DRV_VERSION} -RESULT=$? - -if [[ "$RESULT" != "0" ]] -then - 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 "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver.sh" - exit $RESULT -fi - -dkms install -m ${DRV_NAME} -v ${DRV_VERSION} -RESULT=$? - -if [[ "$RESULT" != "0" ]] -then - 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 "You will need to run the following before reattempting installation." - echo "$ sudo ./remove-driver.sh" - exit $RESULT -fi - -echo "The driver was installed successfully." - # unblock wifi rfkill unblock wlan diff --git a/remove-driver-no-dkms.sh b/remove-driver-no-dkms.sh deleted file mode 100755 index 9a747fb..0000000 --- a/remove-driver-no-dkms.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -# Purpose: Remove Realtek USB WiFi adapter drivers. -# -# This version of the removal script does not use dkms. - -SCRIPT_NAME="remove-driver-no-dkms.sh" -SCRIPT_VERSION="20220913" -OPTIONS_FILE="88x2bu.conf" - -MODULE_NAME="88x2bu" -KVER="$(uname -r)" -KSRC="/lib/modules/${KVER}/build" -MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" - -BLACKLIST_FILE="rtw88_8822bu.conf" - -# support for NoPrompt allows non-interactive use of this script -NO_PROMPT=0 - -# get the options -while [ $# -gt 0 ] -do - case $1 in - NoPrompt) - NO_PROMPT=1 ;; - *h|*help|*) - echo "Syntax $0 " - echo " NoPrompt - noninteractive mode" - echo " -h|--help - Show help" - exit 1 - ;; - esac - shift -done - -# check to ensure sudo was used -if [[ $EUID -ne 0 ]] -then - echo "You must run this script with superuser (root) privileges." - echo "Try: \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - -# displays script name and version -echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" - -make uninstall -RESULT=$? - -if [[ ("$RESULT" = "0")]] -then - echo "Deleting ${OPTIONS_FILE} from /etc/modprobe.d" - rm -f /etc/modprobe.d/${OPTIONS_FILE} - echo "Deleting ${BLACKLIST_FILE} from /etc/modprobe.d" - rm -f /etc/modprobe.d/${BLACKLIST_FILE} - echo "The driver was removed successfully." - echo "You may now delete the driver directory if desired." -else - echo "An error occurred. Error = ${RESULT}" - echo "Please report this error." - exit $RESULT -fi - -# if NoPrompt is not used, ask user some questions to complete removal -if [ $NO_PROMPT -ne 1 ] -then - read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - reboot - fi -fi - -exit 0 diff --git a/remove-driver.sh b/remove-driver.sh index 457778a..c5c6153 100755 --- a/remove-driver.sh +++ b/remove-driver.sh @@ -2,20 +2,29 @@ # Purpose: Remove Realtek USB WiFi adapter drivers. # -# This version of the removal script uses dkms. +# Supports dkms and non-dkms removals. SCRIPT_NAME="remove-driver.sh" -SCRIPT_VERSION="20220821" +SCRIPT_VERSION="20220927" OPTIONS_FILE="88x2bu.conf" BLACKLIST_FILE="rtw88_8822bu.conf" +MODULE_NAME="88x2bu" +KVER="$(uname -r)" +KSRC="/lib/modules/${KVER}/build" +MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/" + DRV_NAME="rtl88x2bu" DRV_VERSION="5.13.1" - DRV_DIR="$(pwd)" -KRNL_VERSION="$(uname -r)" -echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" +# check to ensure sudo was used +if [[ $EUID -ne 0 ]] +then + echo "You must run this script with superuser (root) privileges." + echo "Try: \"sudo ./${SCRIPT_NAME}\"" + exit 1 +fi # support for NoPrompt allows non-interactive use of this script NO_PROMPT=0 @@ -36,14 +45,8 @@ do shift done -# check to ensure sudo was used -if [[ $EUID -ne 0 ]] -then - echo "You must run this script with superuser (root) privileges." - echo "Try: \"sudo ./${SCRIPT_NAME}\"" - exit 1 -fi - +# displays script name and version +echo "Running ${SCRIPT_NAME} version ${SCRIPT_VERSION}" echo "Starting removal..." dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all @@ -60,6 +63,9 @@ then rm -f /etc/modprobe.d/${BLACKLIST_FILE} echo "Deleting source files from /usr/src/${DRV_NAME}-${DRV_VERSION}" rm -rf /usr/src/${DRV_NAME}-${DRV_VERSION} + echo "Removing a non-dkms installation." + rm -f $(MODDESTDIR)$(MODULE_NAME).ko + /sbin/depmod -a ${KVER} echo "The driver was removed successfully." echo "You may now delete the driver directory if desired." else @@ -68,6 +74,7 @@ else exit $RESULT fi +# if NoPrompt is not used, ask user some questions to complete removal if [ $NO_PROMPT -ne 1 ] then read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r