numerous updates- MU-MIMO works
This commit is contained in:
parent
d0f2241ec5
commit
9597e68f44
@ -10,13 +10,13 @@
|
|||||||
blacklist rtw88_8822bu
|
blacklist rtw88_8822bu
|
||||||
#
|
#
|
||||||
# Edit the following line to change, add or delete options:
|
# Edit the following line to change, add or delete options:
|
||||||
options 88x2bu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgnt=1 rtw_switch_usb_mode=0
|
options 88x2bu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_switch_usb_mode=0
|
||||||
#
|
#
|
||||||
# Note: To activate USB3 mode, change rtw_switch_usb_mode above to rtw_switch_usb_mode=1
|
# Note: To activate USB3 mode, change rtw_switch_usb_mode above to rtw_switch_usb_mode=1
|
||||||
#
|
#
|
||||||
# Note: The above `options` line is a good default for managed mode. Below is
|
# Note: The above `options` line is a good default for managed mode. Below is
|
||||||
# an example for AP mode. Modify as required after reading the documentation:
|
# an example for AP mode. Modify as required after reading the documentation:
|
||||||
#options 88x2bu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=2 rtw_power_mgnt=1 rtw_beamform_cap=1 rtw_dfs_region_domain=1
|
#options 88x2bu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=2 rtw_power_mgnt=1 rtw_beamform_cap=1 rtw_switch_usb_mode=1 rtw_dfs_region_domain=1
|
||||||
#
|
#
|
||||||
# After editing is complete, save this file (if using nano: Ctrl + x, y, Enter)
|
# After editing is complete, save this file (if using nano: Ctrl + x, y, Enter)
|
||||||
# and reboot to activate the changes.
|
# and reboot to activate the changes.
|
||||||
@ -40,7 +40,7 @@ options 88x2bu rtw_drv_log_level=1 rtw_led_ctrl=1 rtw_vht_enable=1 rtw_power_mgn
|
|||||||
#
|
#
|
||||||
# sudo ./save-log.sh
|
# sudo ./save-log.sh
|
||||||
#
|
#
|
||||||
# Note: The name of the log file will be ```rtw.log```.
|
# Note: The name of the log file will be `rtw.log`.
|
||||||
#
|
#
|
||||||
# -----
|
# -----
|
||||||
#
|
#
|
||||||
|
|||||||
1
Kconfig
1
Kconfig
@ -1,6 +1,7 @@
|
|||||||
config RTL8822BU
|
config RTL8822BU
|
||||||
tristate "Realtek 8822B USB WiFi"
|
tristate "Realtek 8822B USB WiFi"
|
||||||
depends on USB
|
depends on USB
|
||||||
|
select WIRELESS_EXT
|
||||||
help
|
help
|
||||||
Help message of RTL8822BU
|
Help message of RTL8822BU
|
||||||
|
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright(c) 2007 - 2022 Realtek Corporation.
|
* Copyright(c) 2007 - 2023 Realtek Corporation.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* under the terms of version 2 of the GNU General Public License as
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -2513,7 +2513,7 @@ install:
|
|||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a ${KVER}
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
|
rm -f $(MODDESTDIR)$(MODULE_NAME).ko
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a ${KVER}
|
||||||
|
|
||||||
backup_rtlwifi:
|
backup_rtlwifi:
|
||||||
|
|||||||
115
README.md
115
README.md
@ -18,6 +18,10 @@ confirm that this is the correct driver for your adapter.
|
|||||||
* Supports WPA/WPA2 TLS client
|
* Supports WPA/WPA2 TLS client
|
||||||
- Power saving modes
|
- Power saving modes
|
||||||
- Miracast
|
- Miracast
|
||||||
|
- WiFi-Direct
|
||||||
|
- MU-MIMO
|
||||||
|
- Mesh
|
||||||
|
- Wake on WLAN
|
||||||
- Wireshark compatible
|
- Wireshark compatible
|
||||||
- Aircrack-ng compatible
|
- Aircrack-ng compatible
|
||||||
- Packet injection
|
- Packet injection
|
||||||
@ -44,7 +48,7 @@ confirm that this is the correct driver for your adapter.
|
|||||||
|
|
||||||
- x86, i686
|
- x86, i686
|
||||||
- x86-64, amd64
|
- x86-64, amd64
|
||||||
- armv7l, armv6l (arm)
|
- armv6l, armv7l (arm)
|
||||||
- aarch64 (arm64)
|
- aarch64 (arm64)
|
||||||
|
|
||||||
### Compatible Kernels
|
### Compatible Kernels
|
||||||
@ -54,7 +58,7 @@ confirm that this is the correct driver for your adapter.
|
|||||||
|
|
||||||
### Tested Compilers
|
### Tested Compilers
|
||||||
|
|
||||||
- gcc 9, 10, 11 and 12
|
- gcc 10, 11 and 12
|
||||||
|
|
||||||
### Tested Linux Distributions
|
### Tested Linux Distributions
|
||||||
|
|
||||||
@ -67,7 +71,7 @@ be provided via PR or message in Issues.
|
|||||||
|
|
||||||
- Debian 11 (kernels 5.10 and 5.15)
|
- Debian 11 (kernels 5.10 and 5.15)
|
||||||
|
|
||||||
- Fedora (kernel 5.11) and Fedora 37 (kernel 6.0)
|
- Fedora 37 (kernel 6.0)
|
||||||
|
|
||||||
- Kali Linux (kernel 5.10)
|
- Kali Linux (kernel 5.10)
|
||||||
|
|
||||||
@ -122,10 +126,6 @@ a modification or two to the Makefile).
|
|||||||
|
|
||||||
### Compatible Devices
|
### Compatible Devices
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
* [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)
|
* [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
|
* ASUS AC1300 USB-AC55 B1
|
||||||
* ASUS AC53 Nano
|
* ASUS AC53 Nano
|
||||||
@ -141,6 +141,17 @@ item 2 which will show information about and links to recommended adapters.
|
|||||||
* TRENDnet TEW-808UBM
|
* TRENDnet TEW-808UBM
|
||||||
* Numerous additional products that are based on the supported chipsets
|
* Numerous additional products that are based on the supported chipsets
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Note: If you decide to buy an adapter that is supported by this driver, I
|
||||||
|
recommend you search for an adapter that is `single-state and single-function`.
|
||||||
|
Multi-function adapters, wifi and bluetooth, can be problematic. The rtl8822bu
|
||||||
|
chipset is multi-fuction. The rtl8812bu chipset is single-function. For advice
|
||||||
|
about single-state and multi-state adapters. click
|
||||||
|
[here](https://github.com/morrownr/USB-WiFi) and look for Main Menu item 1.
|
||||||
|
|
||||||
### Installation Information
|
### Installation Information
|
||||||
|
|
||||||
Note: As of Linux kernel 6.2, an in-kernel driver for the chipsets supported by
|
Note: As of Linux kernel 6.2, an in-kernel driver for the chipsets supported by
|
||||||
@ -155,7 +166,7 @@ or if you have previously installed another driver for chipsets supported by
|
|||||||
this driver, you MUST remove anything that the previous attempt
|
this driver, you MUST remove anything that the previous attempt
|
||||||
installed BEFORE attempting to install this driver. This driver can be
|
installed BEFORE attempting to install this driver. This driver can be
|
||||||
removed with the script called `./remove-driver.sh`. Information is
|
removed with the script called `./remove-driver.sh`. Information is
|
||||||
available in the section called `Removal of the Driver.` You can get a
|
available in the section called `Removal of the Driver`. You can get a
|
||||||
good idea as to whether you need to remove a previously installed
|
good idea as to whether you need to remove a previously installed
|
||||||
driver by running the following command:
|
driver by running the following command:
|
||||||
|
|
||||||
@ -164,14 +175,20 @@ sudo dkms status
|
|||||||
```
|
```
|
||||||
|
|
||||||
Warning: If you decide to upgrade to a new version of kernel such as
|
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
|
5.15 to 5.19, you need to upgrade the driver you have installed with
|
||||||
install the newest available before installing the new kernel. Use the
|
the newest available before installing the new kernel. Use the
|
||||||
following commands in the driver directory:
|
following commands in the driver directory:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ sudo ./remove-driver.sh
|
sudo ./remove-driver.sh
|
||||||
$ git pull
|
```
|
||||||
$ sudo ./install-driver.sh
|
|
||||||
|
```
|
||||||
|
git pull
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo ./install-driver.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Temporary internet access is required for installation. There are numerous ways
|
Temporary internet access is required for installation. There are numerous ways
|
||||||
@ -272,7 +289,7 @@ system to work with. The installation can then be continued with Step 3.
|
|||||||
sudo reboot
|
sudo reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Step 3: Install the required packages (select the option for the OS you are using)
|
#### Step 3: Install the required packages (select the option for the distro you are using)
|
||||||
|
|
||||||
Note: If your Linux distro does not fall into one of options listed
|
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
|
below, you will need to research how to properly setup up the development
|
||||||
@ -375,14 +392,23 @@ git clone https://github.com/morrownr/88x2bu-20210702.git
|
|||||||
cd ~/src/88x2bu-20210702
|
cd ~/src/88x2bu-20210702
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Step 8: 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.
|
Note: It is recommended that you terminate running apps so as to provide the
|
||||||
|
maximum amount of RAM to the compilation process.
|
||||||
|
|
||||||
|
Note: For automated builds (non-interactive), use `NoPrompt` as an option.
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo ./install-driver.sh
|
sudo ./install-driver.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo sh install-driver.sh
|
||||||
|
```
|
||||||
|
|
||||||
Note: If you elect to skip the reboot at the end of the installation
|
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
|
script, the driver may not load immediately and the driver options will
|
||||||
not be applied. Rebooting is strongly recommended.
|
not be applied. Rebooting is strongly recommended.
|
||||||
@ -390,28 +416,49 @@ not be applied. Rebooting is strongly recommended.
|
|||||||
Note: Fedora users that have secure boot turned on should run the following to
|
Note: Fedora users that have secure boot turned on should run the following to
|
||||||
enroll the key:
|
enroll the key:
|
||||||
|
|
||||||
$ sudo mokutil --import /var/lib/dkms/mok.pub
|
```
|
||||||
|
sudo mokutil --import /var/lib/dkms/mok.pub
|
||||||
|
```
|
||||||
|
|
||||||
Manual build instructions: The above script automates the installation
|
Manual build and installation instructions: The above installation steps
|
||||||
process, however, if you want to or need to do a command line
|
automate the installation process, however, if you want to or need to do a
|
||||||
installation, use the following:
|
command line installation, use the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
make clean
|
make clean
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
make
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
sudo make install
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
sudo reboot
|
sudo reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: If you use the manual build instructions, you will need to repeat
|
To remove the driver if installed by the manual installation instructions:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo make uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo reboot
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: If you use the manual installation instructions, you will need to repeat
|
||||||
the process each time a new kernel is installed in your distro.
|
the process each time a new kernel is installed in your distro.
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
### Driver Options ( edit-options.sh )
|
### Driver Options (`edit-options.sh`)
|
||||||
|
|
||||||
A file called `88x2bu.conf` will be installed in `/etc/modprobe.d` by
|
A file called `88x2bu.conf` will be installed in `/etc/modprobe.d` by
|
||||||
default if you use the `./install-driver.sh` script.
|
default if you use the `install-driver.sh` script.
|
||||||
|
|
||||||
Note: The installation script will prompt you to edit the options.
|
Note: The installation script will prompt you to edit the options.
|
||||||
|
|
||||||
@ -463,7 +510,7 @@ sudo ./install-driver.sh
|
|||||||
```
|
```
|
||||||
|
|
||||||
-----
|
-----
|
||||||
### Removal of the Driver ( remove-driver.sh )
|
### Removal of the Driver (`remove-driver.sh`)
|
||||||
|
|
||||||
Note: Removing the driver is advised in the following situations:
|
Note: Removing the driver is advised in the following situations:
|
||||||
|
|
||||||
@ -484,7 +531,7 @@ cd ~/src/88x2bu-20210702
|
|||||||
|
|
||||||
#### Step 3: Run the removal script
|
#### Step 3: Run the removal script
|
||||||
|
|
||||||
Note: For automated builds (non-interactive), use _NoPrompt_ as an option.
|
Note: For automated builds (non-interactive), use `NoPrompt` as an option.
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo ./remove-driver.sh
|
sudo ./remove-driver.sh
|
||||||
@ -510,7 +557,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.
|
- 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 get an idea of 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.
|
After making and saving changes, reboot the router.
|
||||||
|
|
||||||
@ -536,7 +583,7 @@ After making and saving changes, reboot the router.
|
|||||||
|
|
||||||
### How to disable onboard WiFi on Raspberry Pi 3B, 3B+, 3A+, 4B and Zero W
|
### How to disable onboard WiFi on Raspberry Pi 3B, 3B+, 3A+, 4B and Zero W
|
||||||
|
|
||||||
Add the following line to /boot/config.txt
|
Add the following line to `/boot/config.txt`
|
||||||
|
|
||||||
```
|
```
|
||||||
dtoverlay=disable-wifi
|
dtoverlay=disable-wifi
|
||||||
@ -546,21 +593,23 @@ dtoverlay=disable-wifi
|
|||||||
|
|
||||||
### How to forget a saved WiFi network on a Raspberry Pi
|
### How to forget a saved WiFi network on a Raspberry Pi
|
||||||
|
|
||||||
#### Step 1: Edit wpa_supplicant.conf
|
#### Step 1: Edit `wpa_supplicant.conf`
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
|
sudo ${EDITOR} /etc/wpa_supplicant/wpa_supplicant.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Step 2: Delete the relevant WiFi network block (including the 'network=' and opening/closing braces.
|
Note: Replace ${EDITOR} with the name of the text editor you wish to use.
|
||||||
|
|
||||||
#### Step 3: Press ctrl-x followed by 'y' and enter to save the file.
|
#### Step 2: Delete the relevant WiFi network block (including the '`network=`' and opening/closing braces).
|
||||||
|
|
||||||
|
#### Step 3: Press ctrl-x followed by '`y`' and enter to save the file.
|
||||||
|
|
||||||
#### Step 4: Reboot
|
#### Step 4: Reboot
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
### FAQ:
|
### FAQ
|
||||||
|
|
||||||
Question: Is WPA3 supported?
|
Question: Is WPA3 supported?
|
||||||
|
|
||||||
@ -672,7 +721,7 @@ reports of success or failure are needed. If you have yet to buy an
|
|||||||
adapter to use with monitor mode, there are adapters available that are
|
adapter to use with monitor mode, there are adapters available that are
|
||||||
known to work very well with monitor mode. My recommendation for those
|
known to work very well with monitor mode. My recommendation for those
|
||||||
looking to buy an adapter for monitor mode is to buy adapters based on
|
looking to buy an adapter for monitor mode is to buy adapters based on
|
||||||
the following chipsets: mt7921au, mt7612u, mt7610u, rtl8812au and
|
the following chipsets: mt7921au, mt7612u, mt7610u, rtl8812au, rtl8821cu and
|
||||||
rtl8811au. My specific recommendations for adapters in order of
|
rtl8811au. My specific recommendations for adapters in order of
|
||||||
preference are:
|
preference are:
|
||||||
|
|
||||||
|
|||||||
1
default-editor.txt
Normal file
1
default-editor.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
nano
|
||||||
17
dkms-make.sh
Executable file
17
dkms-make.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SMEM needs to be set here if dkms build is not initiated by install-driver.sh
|
||||||
|
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
|
||||||
|
|
||||||
|
# sproc needs to be set here if dkms build is not initiated by install-driver.sh
|
||||||
|
sproc=$(nproc)
|
||||||
|
|
||||||
|
# avoid Out of Memory condition in low-RAM systems by limiting core usage
|
||||||
|
if [ "$sproc" -gt 1 ]; then
|
||||||
|
if [ "$SMEM" -lt 1400000 ]; then
|
||||||
|
sproc=2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
kernelver=${kernelver:-$(uname -r)}
|
||||||
|
make "-j$sproc" "KVER=$kernelver" "KSRC=/lib/modules/$kernelver/build"
|
||||||
@ -1,7 +1,7 @@
|
|||||||
PACKAGE_NAME="rtl88x2bu"
|
PACKAGE_NAME="rtl88x2bu"
|
||||||
PACKAGE_VERSION="5.13.1"
|
PACKAGE_VERSION="5.13.1"
|
||||||
MAKE[0]="'make' -j$(nproc) KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build"
|
|
||||||
CLEAN="'make' clean"
|
|
||||||
BUILT_MODULE_NAME[0]="88x2bu"
|
BUILT_MODULE_NAME[0]="88x2bu"
|
||||||
DEST_MODULE_LOCATION[0]="/kernel/drivers/net/wireless"
|
MAKE="./dkms-make.sh"
|
||||||
AUTOINSTALL="yes"
|
CLEAN="'make' clean"
|
||||||
|
DEST_MODULE_LOCATION[0]="/updates/dkms"
|
||||||
|
AUTOINSTALL="YES"
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
#
|
|
||||||
OPTIONS_FILE="88x2bu.conf"
|
|
||||||
SCRIPT_NAME="edit-options.sh"
|
|
||||||
#
|
|
||||||
# Purpose: Make it easier to edit the driver options file.
|
# Purpose: Make it easier to edit the driver options file.
|
||||||
#
|
#
|
||||||
|
# Flexible editor support.
|
||||||
|
#
|
||||||
# To make this file executable:
|
# To make this file executable:
|
||||||
#
|
#
|
||||||
# $ chmod +x edit-options.sh
|
# $ chmod +x edit-options.sh
|
||||||
@ -13,20 +12,45 @@ SCRIPT_NAME="edit-options.sh"
|
|||||||
#
|
#
|
||||||
# $ sudo ./edit-options.sh
|
# $ sudo ./edit-options.sh
|
||||||
#
|
#
|
||||||
if [[ $EUID -ne 0 ]]
|
# Copyright(c) 2023 Nick Morrow
|
||||||
then
|
#
|
||||||
|
# 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="edit-options.sh"
|
||||||
|
# SCRIPT_VERSION="20230126"
|
||||||
|
OPTIONS_FILE="88x2bu.conf"
|
||||||
|
|
||||||
|
# check to ensure sudo was used to start the script
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nano /etc/modprobe.d/${OPTIONS_FILE}
|
DEFAULT_EDITOR="$(cat default-editor.txt)"
|
||||||
|
# try to find the user's default text editor through the EDITORS_SEARCH array
|
||||||
read -p "Do you want to apply the new options by rebooting now? [y/N] " -n 1 -r
|
for TEXT_EDITOR in "${VISUAL}" "${EDITOR}" "${DEFAULT_EDITOR}" vi; do
|
||||||
echo # move to a new line
|
command -v "${TEXT_EDITOR}" >/dev/null 2>&1 && break
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
done
|
||||||
then
|
# failure message if no editor was found
|
||||||
reboot
|
if ! command -v "${TEXT_EDITOR}" >/dev/null 2>&1; then
|
||||||
|
echo "No text editor was found (default: ${DEFAULT_EDITOR})."
|
||||||
|
echo "Please install ${DEFAULT_EDITOR} or edit the file 'default-editor.txt' to specify your editor."
|
||||||
|
echo "Once complete, please run \"sudo ./${SCRIPT_NAME}\""
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE}
|
||||||
|
|
||||||
|
printf "Do you want to apply the new options by rebooting now? (recommended) [y/N] "
|
||||||
|
read -r REPLY
|
||||||
|
case "$REPLY" in
|
||||||
|
[yY]*) reboot ;;
|
||||||
|
esac
|
||||||
|
|||||||
@ -1,9 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Purpose: Install Realtek out-of-kernel USB WiFi adapter drivers.
|
# Purpose: Install Realtek out-of-kernel USB WiFi adapter drivers.
|
||||||
#
|
#
|
||||||
# Supports dkms and non-dkms installations.
|
# Supports dkms and non-dkms installations.
|
||||||
|
#
|
||||||
|
# To make this file executable:
|
||||||
|
#
|
||||||
|
# $ chmod +x edit-options.sh
|
||||||
|
#
|
||||||
|
# To execute this file:
|
||||||
|
#
|
||||||
|
# $ sudo ./edit-options.sh
|
||||||
|
#
|
||||||
# Copyright(c) 2023 Nick Morrow
|
# Copyright(c) 2023 Nick Morrow
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -16,88 +24,27 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
SCRIPT_NAME="install-driver.sh"
|
SCRIPT_NAME="install-driver.sh"
|
||||||
SCRIPT_VERSION="20230109"
|
SCRIPT_VERSION="20230126"
|
||||||
MODULE_NAME="88x2bu"
|
MODULE_NAME="88x2bu"
|
||||||
DRV_VERSION="5.13.1"
|
DRV_VERSION="5.13.1"
|
||||||
|
|
||||||
KVER="$(uname -r)"
|
KVER="$(uname -r)"
|
||||||
KARCH="$(uname -m)"
|
KARCH="$(uname -m)"
|
||||||
#KSRC="/lib/modules/${KVER}/build"
|
|
||||||
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
|
||||||
DRV_NAME="rtl${MODULE_NAME}"
|
DRV_NAME="rtl${MODULE_NAME}"
|
||||||
DRV_DIR="$(pwd)"
|
DRV_DIR="$(pwd)"
|
||||||
OPTIONS_FILE="${MODULE_NAME}.conf"
|
OPTIONS_FILE="${MODULE_NAME}.conf"
|
||||||
|
|
||||||
# check to ensure sudo was used
|
# check to ensure sudo was used to start the script
|
||||||
if [[ $EUID -ne 0 ]]
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
then
|
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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 is not 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 is not 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 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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check to ensure iw is installed
|
|
||||||
if ! command -v iw >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check to ensure rfkill is installed
|
|
||||||
if ! command -v rfkill >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check to ensure nano is installed
|
|
||||||
if ! command -v nano >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
|
|
||||||
# support for the NoPrompt option allows non-interactive use of this script
|
# support for the NoPrompt option allows non-interactive use of this script
|
||||||
NO_PROMPT=0
|
NO_PROMPT=0
|
||||||
|
|
||||||
# get the script options
|
# get the script options
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -114,41 +61,113 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 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 is not 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 is not 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 the correct header files are installed
|
||||||
|
if [ ! -d "/lib/modules/$(uname -r)/build" ]; then
|
||||||
|
echo "Your kernel header files aren't properly installed."
|
||||||
|
echo "Please consult your distro documentation or user support forums."
|
||||||
|
echo "Once the header files are properly installed, please run \"sudo ./${SCRIPT_NAME}\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check to ensure iw is installed
|
||||||
|
if ! command -v iw >/dev/null 2>&1; then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check to ensure rfkill is installed
|
||||||
|
if ! command -v rfkill >/dev/null 2>&1; then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEFAULT_EDITOR="$(cat default-editor.txt)"
|
||||||
|
# try to find the user's default text editor through the EDITORS_SEARCH array
|
||||||
|
for TEXT_EDITOR in "${VISUAL}" "${EDITOR}" "${DEFAULT_EDITOR}" vi; do
|
||||||
|
command -v "${TEXT_EDITOR}" >/dev/null 2>&1 && break
|
||||||
|
done
|
||||||
|
# fail if no editor was found
|
||||||
|
if ! command -v "${TEXT_EDITOR}" >/dev/null 2>&1; then
|
||||||
|
echo "No text editor found (default: ${DEFAULT_EDITOR})."
|
||||||
|
echo "Please install ${DEFAULT_EDITOR} or edit the file 'default-editor.txt' to specify your editor."
|
||||||
|
echo "Once complete, please run \"sudo ./${SCRIPT_NAME}\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ": ---------------------------"
|
||||||
|
|
||||||
# displays script name and version
|
# displays script name and version
|
||||||
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
||||||
|
|
||||||
# information that helps with bug reports
|
# information that helps with bug reports
|
||||||
|
|
||||||
# display architecture
|
# display architecture
|
||||||
echo ": ${KARCH}"
|
echo ": ${KARCH} (architecture)"
|
||||||
|
|
||||||
# display total memory in system
|
SMEM=$(LANG=C free | awk '/Mem:/ { print $2 }')
|
||||||
#grep MemTotal /proc/meminfo
|
sproc=$(nproc)
|
||||||
|
# avoid Out of Memory condition in low-RAM systems by limiting core usage
|
||||||
|
if [ "$sproc" -gt 1 ]; then
|
||||||
|
if [ "$SMEM" -lt 1400000 ]
|
||||||
|
then
|
||||||
|
sproc=2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# display number of in-use processing units / total processing units
|
||||||
|
echo ": ${sproc}/$(nproc) (in-use/total processing units)"
|
||||||
|
|
||||||
|
# display total system memory
|
||||||
|
echo ": ${SMEM} (total system memory)"
|
||||||
|
|
||||||
# display kernel version
|
# display kernel version
|
||||||
echo ": ${KVER}"
|
echo ": ${KVER} (kernel version)"
|
||||||
|
|
||||||
# display gcc version
|
# display gcc version
|
||||||
gcc_ver=$(gcc --version | grep -i gcc)
|
gcc_ver=$(gcc --version | grep -i gcc)
|
||||||
echo ": "${gcc_ver}
|
echo ": ""${gcc_ver}"
|
||||||
|
|
||||||
# display dkms version if installed
|
# display dkms version if installed
|
||||||
if command -v dkms >/dev/null 2>&1
|
if command -v dkms >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
dkms_ver=$(dkms --version)
|
dkms_ver=$(dkms --version)
|
||||||
echo ": "${dkms_ver}
|
echo ": ""${dkms_ver}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# display secure mode status if mokutil is installed
|
# display secure mode status if mokutil is installed
|
||||||
if command -v mokutil >/dev/null 2>&1
|
if command -v mokutil >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
sb_state=$(mokutil --sb-state)
|
sb_state=$(mokutil --sb-state)
|
||||||
echo ": "${sb_state}
|
echo ": ""${sb_state}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# needs work
|
||||||
# display ISO 3166-1 alpha-2 Country Code
|
# display ISO 3166-1 alpha-2 Country Code
|
||||||
#a2_country_code=$(iw reg get | grep -i country)
|
#a2_country_code=$(iw reg get | grep -i country)
|
||||||
#echo "Country: "${a2_country_code}
|
#echo ": Location: ""${a2_country_code}"
|
||||||
#if [[ $a2_country_code == *"00"* ]];
|
#if [[ $a2_country_code == *"00"* ]];
|
||||||
#then
|
#then
|
||||||
# echo "The Country Code may not be properly set."
|
# echo "The Country Code may not be properly set."
|
||||||
@ -156,13 +175,14 @@ fi
|
|||||||
# echo "Please read and follow the directions in the file after installation."
|
# echo "Please read and follow the directions in the file after installation."
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
|
echo ": ---------------------------"
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# standard naming
|
# standard naming
|
||||||
if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]]
|
if [ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}"${MODULE_NAME}.ko
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
||||||
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
||||||
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
||||||
@ -172,11 +192,10 @@ fi
|
|||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# with rtl added to module name (PClinuxOS)
|
# with rtl added to module name (PClinuxOS)
|
||||||
if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]]
|
if [ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}"rtl${MODULE_NAME}.ko
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
||||||
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
||||||
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
||||||
@ -188,11 +207,10 @@ fi
|
|||||||
# with compressed module in a unique non-standard location (Armbian)
|
# 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
|
# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz
|
||||||
# Dear Armbiam, this is a really bad idea.
|
# Dear Armbiam, this is a really bad idea.
|
||||||
if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]]
|
if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz"
|
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
|
rm -f /usr/lib/modules/"${KVER}"/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
||||||
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
rm -f /etc/modprobe.d/${OPTIONS_FILE}
|
||||||
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
echo "Removing source files from /usr/src/${DRV_NAME}-${DRV_VERSION}"
|
||||||
@ -201,10 +219,8 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove dkms installations
|
# check for and remove dkms installations
|
||||||
if command -v dkms >/dev/null 2>&1
|
if command -v dkms >/dev/null 2>&1; then
|
||||||
then
|
if dkms status | grep -i ${DRV_NAME}; then
|
||||||
if dkms status | grep -i ${DRV_NAME}
|
|
||||||
then
|
|
||||||
echo "Removing a dkms installation: ${DRV_NAME}"
|
echo "Removing a dkms installation: ${DRV_NAME}"
|
||||||
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all
|
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all
|
||||||
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
echo "Removing ${OPTIONS_FILE} from /etc/modprobe.d"
|
||||||
@ -219,17 +235,15 @@ echo "Installing ${OPTIONS_FILE} to /etc/modprobe.d"
|
|||||||
cp -f ${OPTIONS_FILE} /etc/modprobe.d
|
cp -f ${OPTIONS_FILE} /etc/modprobe.d
|
||||||
|
|
||||||
# determine if dkms is installed and run the appropriate routines
|
# determine if dkms is installed and run the appropriate routines
|
||||||
if ! command -v dkms >/dev/null 2>&1
|
if ! command -v dkms >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "The non-dkms installation routines are in use."
|
echo "The non-dkms installation routines are in use."
|
||||||
|
|
||||||
make clean >/dev/null 2>&1
|
make clean >/dev/null 2>&1
|
||||||
|
|
||||||
make -j$(nproc)
|
make -j"$(nproc)"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [[ "$RESULT" != "0" ]]
|
if [ "$RESULT" != "0" ]; then
|
||||||
then
|
|
||||||
echo "An error occurred: ${RESULT}"
|
echo "An error occurred: ${RESULT}"
|
||||||
echo "Please report this error."
|
echo "Please report this error."
|
||||||
echo "Please copy all screen output and paste it into the problem report."
|
echo "Please copy all screen output and paste it into the problem report."
|
||||||
@ -245,8 +259,7 @@ then
|
|||||||
make install
|
make install
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [[ "$RESULT" = "0" ]]
|
if [ "$RESULT" = "0" ]; then
|
||||||
then
|
|
||||||
make clean >/dev/null 2>&1
|
make clean >/dev/null 2>&1
|
||||||
echo "The driver was installed successfully."
|
echo "The driver was installed successfully."
|
||||||
else
|
else
|
||||||
@ -269,10 +282,8 @@ else
|
|||||||
|
|
||||||
# RESULT will be 3 if the DKMS tree already contains the same module/version
|
# RESULT will be 3 if the DKMS tree already contains the same module/version
|
||||||
# combo. You cannot add the same module/version combo more than once.
|
# combo. You cannot add the same module/version combo more than once.
|
||||||
if [[ "$RESULT" != "0" ]]
|
if [ "$RESULT" != "0" ]; then
|
||||||
then
|
if [ "$RESULT" = "3" ]; then
|
||||||
if [[ "$RESULT" = "3" ]]
|
|
||||||
then
|
|
||||||
echo "This driver may already be installed."
|
echo "This driver may already be installed."
|
||||||
echo "Run the following and then reattempt installation."
|
echo "Run the following and then reattempt installation."
|
||||||
echo "$ sudo ./remove-driver.sh"
|
echo "$ sudo ./remove-driver.sh"
|
||||||
@ -289,16 +300,14 @@ else
|
|||||||
echo "The driver was added to dkms successfully."
|
echo "The driver was added to dkms successfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v /usr/bin/time >/dev/null 2>&1
|
if command -v /usr/bin/time >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
|
/usr/bin/time -f "Compile time: %U seconds" dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
|
||||||
else
|
else
|
||||||
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
|
dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
|
||||||
fi
|
fi
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [[ "$RESULT" != "0" ]]
|
if [ "$RESULT" != "0" ]; then
|
||||||
then
|
|
||||||
echo "An error occurred. dkms build error: ${RESULT}"
|
echo "An error occurred. dkms build error: ${RESULT}"
|
||||||
echo "Please report this error."
|
echo "Please report this error."
|
||||||
echo "Please copy all screen output and paste it into the problem report."
|
echo "Please copy all screen output and paste it into the problem report."
|
||||||
@ -312,8 +321,7 @@ else
|
|||||||
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
|
dkms install -m ${DRV_NAME} -v ${DRV_VERSION}
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [[ "$RESULT" != "0" ]]
|
if [ "$RESULT" != "0" ]; then
|
||||||
then
|
|
||||||
echo "An error occurred. dkms install error: ${RESULT}"
|
echo "An error occurred. dkms install error: ${RESULT}"
|
||||||
echo "Please report this error."
|
echo "Please report this error."
|
||||||
echo "Please copy all screen output and paste it into the problem report."
|
echo "Please copy all screen output and paste it into the problem report."
|
||||||
@ -326,29 +334,23 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# unblock wifi
|
# unblock wifi
|
||||||
if command -v rfkill >/dev/null 2>&1
|
if command -v rfkill >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
rfkill unblock wlan
|
rfkill unblock wlan
|
||||||
else
|
else
|
||||||
echo "Unable to run $ rfkill unblock wlan"
|
echo "Unable to run $ rfkill unblock wlan"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if NoPrompt is not used, ask user some questions
|
# if NoPrompt is not used, ask user some questions
|
||||||
if [ $NO_PROMPT -ne 1 ]
|
if [ $NO_PROMPT -ne 1 ]; then
|
||||||
then
|
printf "Do you want to edit the driver options file now? [y/N] "
|
||||||
read -p "Do you want to edit the driver options file now? [y/N] " -n 1 -r
|
read -r REPLY
|
||||||
echo
|
case "$REPLY" in
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
[yY]*) ${TEXT_EDITOR} /etc/modprobe.d/${OPTIONS_FILE} ;;
|
||||||
then
|
esac
|
||||||
nano /etc/modprobe.d/${OPTIONS_FILE}
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r
|
printf "Do you want to apply the new options by rebooting now? (recommended) [y/N] "
|
||||||
echo
|
read -r REPLY
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
case "$REPLY" in
|
||||||
then
|
[yY]*) reboot ;;
|
||||||
reboot
|
esac
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|||||||
@ -1,9 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Purpose: Remove Realtek out-of-kernel USB WiFi adapter drivers.
|
# Purpose: Remove Realtek out-of-kernel USB WiFi adapter drivers.
|
||||||
#
|
#
|
||||||
# Supports dkms and non-dkms removals.
|
# Supports dkms and non-dkms removals.
|
||||||
|
#
|
||||||
|
# To make this file executable:
|
||||||
|
#
|
||||||
|
# $ chmod +x edit-options.sh
|
||||||
|
#
|
||||||
|
# To execute this file:
|
||||||
|
#
|
||||||
|
# $ sudo ./edit-options.sh
|
||||||
|
#
|
||||||
# Copyright(c) 2023 Nick Morrow
|
# Copyright(c) 2023 Nick Morrow
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
@ -16,22 +24,19 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
SCRIPT_NAME="remove-driver.sh"
|
SCRIPT_NAME="remove-driver.sh"
|
||||||
SCRIPT_VERSION="20230109"
|
SCRIPT_VERSION="20230126"
|
||||||
MODULE_NAME="88x2bu"
|
MODULE_NAME="88x2bu"
|
||||||
DRV_VERSION="5.13.1"
|
DRV_VERSION="5.13.1"
|
||||||
|
|
||||||
KVER="$(uname -r)"
|
KVER="$(uname -r)"
|
||||||
KARCH="$(uname -m)"
|
KARCH="$(uname -m)"
|
||||||
#KSRC="/lib/modules/${KVER}/build"
|
|
||||||
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
MODDESTDIR="/lib/modules/${KVER}/kernel/drivers/net/wireless/"
|
||||||
|
|
||||||
DRV_NAME="rtl${MODULE_NAME}"
|
DRV_NAME="rtl${MODULE_NAME}"
|
||||||
DRV_DIR="$(pwd)"
|
|
||||||
OPTIONS_FILE="${MODULE_NAME}.conf"
|
OPTIONS_FILE="${MODULE_NAME}.conf"
|
||||||
|
|
||||||
# check to ensure sudo was used
|
# check to ensure sudo was used to start the script
|
||||||
if [[ $EUID -ne 0 ]]
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
then
|
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
exit 1
|
exit 1
|
||||||
@ -39,10 +44,8 @@ fi
|
|||||||
|
|
||||||
# support for the NoPrompt option allows non-interactive use of this script
|
# support for the NoPrompt option allows non-interactive use of this script
|
||||||
NO_PROMPT=0
|
NO_PROMPT=0
|
||||||
|
|
||||||
# get the script options
|
# get the script options
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]; do
|
||||||
do
|
|
||||||
case $1 in
|
case $1 in
|
||||||
NoPrompt)
|
NoPrompt)
|
||||||
NO_PROMPT=1 ;;
|
NO_PROMPT=1 ;;
|
||||||
@ -56,49 +59,49 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo ": ---------------------------"
|
||||||
|
|
||||||
# displays script name and version
|
# displays script name and version
|
||||||
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
echo ": ${SCRIPT_NAME} v${SCRIPT_VERSION}"
|
||||||
|
|
||||||
|
# information that helps with bug reports
|
||||||
|
|
||||||
|
# display architecture
|
||||||
|
echo ": ${KARCH} (ARCH)"
|
||||||
|
|
||||||
|
# display kernel version
|
||||||
|
echo ": ${KVER}"
|
||||||
|
|
||||||
|
echo ": ---------------------------"
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# standard naming
|
# standard naming
|
||||||
if [[ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]]
|
if [ -f "${MODDESTDIR}${MODULE_NAME}.ko" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}"${MODULE_NAME}.ko
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# with rtl added to module name (PClinuxOS)
|
# with rtl added to module name (PClinuxOS)
|
||||||
if [[ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]]
|
if [ -f "${MODDESTDIR}rtl${MODULE_NAME}.ko" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
echo "Removing a non-dkms installation: ${MODDESTDIR}rtl${MODULE_NAME}.ko"
|
||||||
rm -f ${MODDESTDIR}rtl${MODULE_NAME}.ko
|
rm -f "${MODDESTDIR}"rtl${MODULE_NAME}.ko
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for and remove non-dkms installations
|
# check for and remove non-dkms installations
|
||||||
# with compressed module in a unique non-standard location (Armbian)
|
# 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
|
# Example: /usr/lib/modules/5.15.80-rockchip64/kernel/drivers/net/wireless/rtl8821cu/8821cu.ko.xz
|
||||||
# Dear Armbiam, this is a really bad idea.
|
# Dear Armbiam, this is a really bad idea.
|
||||||
if [[ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]]
|
if [ -f "/usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz" ]; then
|
||||||
then
|
|
||||||
echo "Removing a non-dkms installation: /usr/lib/modules/${KVER}/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz"
|
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
|
rm -f /usr/lib/modules/"${KVER}"/kernel/drivers/net/wireless/${DRV_NAME}/${MODULE_NAME}.ko.xz
|
||||||
/sbin/depmod -a ${KVER}
|
/sbin/depmod -a "${KVER}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# information that helps with bug reports
|
|
||||||
|
|
||||||
# display kernel version
|
|
||||||
echo ": ${KVER}"
|
|
||||||
|
|
||||||
# display architecture
|
|
||||||
echo ": ${KARCH}"
|
|
||||||
|
|
||||||
# determine if dkms is installed and run the appropriate routines
|
# determine if dkms is installed and run the appropriate routines
|
||||||
if command -v dkms >/dev/null 2>&1
|
if command -v dkms >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
echo "Removing a dkms installation."
|
echo "Removing a dkms installation."
|
||||||
# 2>/dev/null suppresses the output of dkms
|
# 2>/dev/null suppresses the output of dkms
|
||||||
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all 2>/dev/null
|
dkms remove -m ${DRV_NAME} -v ${DRV_VERSION} --all 2>/dev/null
|
||||||
@ -108,10 +111,8 @@ then
|
|||||||
# RESULT will be 3 if there are no instances of module to remove
|
# RESULT will be 3 if there are no instances of module to remove
|
||||||
# however we still need to remove various files or the install script
|
# however we still need to remove various files or the install script
|
||||||
# may complain.
|
# may complain.
|
||||||
if [[ ("$RESULT" = "0")||("$RESULT" = "3") ]]
|
if [ "$RESULT" = "0" ] || [ "$RESULT" = "3" ]; then
|
||||||
then
|
if [ "$RESULT" = "0" ]; then
|
||||||
if [[ ("$RESULT" = "0") ]]
|
|
||||||
then
|
|
||||||
echo "${DRV_NAME}/${DRV_VERSION} has been removed"
|
echo "${DRV_NAME}/${DRV_VERSION} has been removed"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -130,14 +131,11 @@ echo "The driver was removed successfully."
|
|||||||
echo "You may now delete the driver directory if desired."
|
echo "You may now delete the driver directory if desired."
|
||||||
|
|
||||||
# if NoPrompt is not used, ask user some questions
|
# if NoPrompt is not used, ask user some questions
|
||||||
if [ $NO_PROMPT -ne 1 ]
|
if [ $NO_PROMPT -ne 1 ]; then
|
||||||
then
|
printf "Do you want to apply the new options by rebooting now? (recommended) [y/N] "
|
||||||
read -p "Do you want to reboot now? (recommended) [y/N] " -n 1 -r
|
read -r REPLY
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
case "$REPLY" in
|
||||||
then
|
[yY]*) reboot ;;
|
||||||
reboot
|
esac
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|||||||
17
save-log.sh
17
save-log.sh
@ -1,7 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
#
|
|
||||||
SCRIPT_NAME="save-log.sh"
|
|
||||||
#
|
|
||||||
# Purpose: Save a log file with RTW lines only.
|
# Purpose: Save a log file with RTW lines only.
|
||||||
#
|
#
|
||||||
# To make this file executable:
|
# To make this file executable:
|
||||||
@ -11,24 +9,25 @@ SCRIPT_NAME="save-log.sh"
|
|||||||
# To execute this file:
|
# To execute this file:
|
||||||
#
|
#
|
||||||
# $ sudo ./edit-options.sh
|
# $ sudo ./edit-options.sh
|
||||||
#
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
SCRIPT_NAME="save-log.sh"
|
||||||
|
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "You must run this script with superuser (root) privileges."
|
echo "You must run this script with superuser (root) privileges."
|
||||||
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Deletes existing log
|
# deletes existing log
|
||||||
rm -f -- rtw.log
|
rm -f -- rtw.log
|
||||||
|
|
||||||
dmesg | cut -d"]" -f2- | grep "RTW" >> rtw.log
|
dmesg | cut -d"]" -f2- | grep "RTW" >> rtw.log
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [[ "$RESULT" != "0" ]]; then
|
if [ "$RESULT" != "0" ]; then
|
||||||
echo "An error occurred while running: ${SCRIPT_NAME}"
|
echo "An error occurred while running: ${SCRIPT_NAME}"
|
||||||
echo "Did you set a log level > 0 ?"
|
echo "Did you set a log level > 0 ?"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "rtw.log saved successfully."
|
echo "rtw.log saved successfully."
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user