Skip to content

Instantly share code, notes, and snippets.

@BenjaminWegener
Forked from kmonsoor/RPi-install-wifi.sh
Last active December 4, 2023 18:30
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BenjaminWegener/98a1d6050c18bf3db4cd6ae002e2e30c to your computer and use it in GitHub Desktop.
Save BenjaminWegener/98a1d6050c18bf3db4cd6ae002e2e30c to your computer and use it in GitHub Desktop.
install wifi adapter drivers on Raspberry Pi; origin: http://www.fars-robotics.net/install-wifi
#!/bin/bash
#set -e
# install-wifi - 03/05/2021 - by MrEngman.
UPDATE_SELF=${UPDATE_SELF:-1}
UPDATE_URI="http://downloads.fars-robotics.net/wifi-drivers/install-wifi"
ROOT_PATH=${ROOT_PATH:-"/"}
WORK_PATH=${WORK_PATH:-"${ROOT_PATH}/root"}
OPTION=${1:-""}
DRIVE=${2:-""}
COMMIT=${3:-""}
function update_self() {
echo " *** Performing self-update"
_tempFileName="$0.tmp"
if ! curl -Ls --output "${_tempFileName}" "${UPDATE_URI}"; then
echo " !!! Failed to download update for install-wifi!"
echo " !!! Make sure you have ca-certificates installed and that the time is set correctly"
exit 1
fi
OCTAL_MODE=$(stat -c '%a' "$0")
if ! chmod ${OCTAL_MODE} "${_tempFileName}" ; then
echo " !!! Failed: Error while trying to set mode on ${_tempFileName}"
exit 1
fi
cat > "${WORK_PATH}/.updateScript.sh" << EOF
if mv "${_tempFileName}" "$0"; then
rm -- "\$0"
exec env UPDATE_SELF=0 /bin/bash "$0" "${OPTION}" "${DRIVE}" "${COMMIT}"
else
echo " !!! Failed!"
fi
EOF
echo " *** Relaunching after update"
exec /bin/bash "${WORK_PATH}/.updateScript.sh"
}
display_help() {
echo "#"
echo "# usage:"
echo "#"
echo "# sudo install-wifi [[-h | --help] |"
echo "# [-c | --check [driver] [rpi-update | commit_id]] |"
echo "# [-u | --update [driver] [rpi-update | commit_id]] |"
echo "# [driver [rpi-update | commit_id]]]"
echo "#"
echo "# options:"
echo "# none - install the driver for the wifi module connected to the Pi for the currently running kernel."
echo "#"
echo "# -h|--help - display usage."
echo "#"
echo "# -c|--check [driver] [option] - check if a driver is available, does not install it."
echo "# driver - specific driver to check for, one of: 8188eu, 8188fu, 8192eu, 8812au, 8821cu, 8822bu, mt7610 or mt7612"
echo "# [option]:- blank - check driver for currently running kernel"
echo "# rpi-update - check driver for latest version of rpi-update"
echo "# commit-id - check driver for specific commit-id of rpi-update"
echo "#"
echo "# -u|--update [driver] [option] - update/install driver, can be used after running, but before rebooting, rpi-update"
echo "# to update the driver to the one needed for the new kernel installed by rpi-update."
echo "# driver - specific driver to update/install, one of: 8188eu, 8188fu, 8192eu, 8812au, 8821cu, 8822bu, mt7610 or mt7612"
echo "# [option]:- blank - update/install driver for currently running kernel"
echo "# rpi-update - update/install driver for latest version of rpi-update"
echo "# commit-id - update/install driver for specific commit-id of rpi-update"
echo "#"
echo "# driver [option] - install specific driver, enables installing the driver for a module not currently connected to"
echo "# the Pi, or installing a driver for a different module if you want to change your wifi module."
echo "# driver - specific driver to install, one of: 8188eu, 8188fu, 8192eu, 8812au, 8821cu, 8822bu, mt7610 or mt7612"
echo "# [option]:- blank - update/install driver for currently running kernel"
echo "# rpi-update - update/install driver for latest version of rpi-update"
echo "# commit-id - update/install driver for specific commit-id of rpi-update"
echo "#"
read -n1 -r -p "Press any key to continue..."
echo
echo "#"
echo "# install-wifi examples:"
echo "#"
echo "# Install/update the wifi driver for the wifi module connected to the Pi for the currently running kernel"
echo "#"
echo "# sudo install-wifi"
echo "#"
echo "# If you want to change your wifi module to one using a different driver that is compatible with this script"
echo "# you can install the driver for the new wifi module, one of: 8188eu, 8188fu, 8192eu, 8812au, 8821cu, 8822bu, mt7610 or mt7612"
echo "# In this example it will install the 8192eu wifi module driver. After installing the driver shutdown the"
echo "# Pi, remove the currently connected wifi module and connect the new 8192eu wifi module and restart your Pi"
echo "# and it should start up with the new wifi adapter connected to your network."
echo "#"
echo "# sudo install-wifi 8192eu - this will install the 8192eu module for the current kernel"
echo "#"
echo "# if you want to run rpi-update, first check a driver is available before you update your code. If the check"
echo "# indicates a driver is available run rpi-update to update the firmware/kernel and then before rebooting"
echo "# update the wifi driver."
echo "#"
echo "# sudo install-wifi -c rpi-update - check for driver if rpi-update is run."
echo "# sudo rpi-update - if a driver is available you can run rpi-update to update firmware."
echo "# sudo install-wifi -u rpi-update - then update the driver for the new kernel installed by rpi-update."
echo "# sudo reboot - now reboot to update the kernel with the new wifi driver."
echo "#"
echo "# if you want to run, say rpi-update b2f6c103e5 to install 3.18.7+ #755, first check a driver is available"
echo "# before you update your code. Then, if a driver is available update the code, and then before rebooting"
echo "# update the wifi driver."
echo "#"
echo "# sudo install-wifi -c b2f6c103e5 - check for driver if rpi-update b2f6c103e5 is run to install kernel 3.18.7+ #755."
echo "# sudo rpi-update b2f6c103e5 - if a driver is available you can run rpi-update b2f6c103e5 to update firmware."
echo "# sudo install-wifi -u b2f6c103e5 - then update the driver for the new kernel installed by rpi-update b2f6c103e5."
echo "# sudo reboot - now reboot to update the kernel with the new wifi driver."
echo "#"
echo "# and finally, you can change the wifi module you are using and install the new driver for it as well as"
echo "# running rpi-update to update the kernel, and assuming in this example the new adapter uses the 8812au"
echo "# driver, using something like:"
echo "#"
echo "# sudo install-wifi -c 8812au rpi-update - check for 8812au driver if rpi-update is run."
echo "# sudo rpi-update - if a driver is available you can run rpi-update to update firmware."
echo "# sudo install-wifi -u 8812au rpi-update - install the 8812au driver for the new kernel installed by rpi-update."
echo "# sudo halt - shutdown the Pi, replace the wifi adapter with the 8812au wifi adapter."
echo "# - restart the Pi with the new kernel and new 8812au wifi module."
echo "#"
}
fetch_driver() {
echo "Checking for a wifi module to determine the driver to install."
echo
echo -n "Your wifi module is "
lsusb > .lsusb
# check for rtl8188eu compatible driver
if cat .lsusb | grep -i '0BDA:FFEF\|2C4E:0102\|0B05:18F0\|7392:B811\|2357:0111\|2357:010C\|056E:4008\|2001:331B\|2001:3311\|0DF6:0076\|2001:3310\|2001:330F\|07B8:8179\|0BDA:0179\|0BDA:8179' ; then
driver=8188eu
# check for rtl8188fu compatible driver
elif cat .lsusb | grep -i '0BDA:F179' ; then
driver=8188fu
# check for rtl8192eu compatible driver
elif cat .lsusb | grep -i '2357:0126\|2019:AB33\|2357:0109\|2357:0108\|2357:0107\|2001:3319\|0BDA:818C\|0BDA:818B' ; then
driver=8192eu
# check for rtl8192su compatible driver
elif cat .lsusb | grep -i '5A57:0291\|0E0B:9063\|0009:21E7\|0DF6:006C\|0DF6:0061\|0409:02B6\|7392:7622\|07AA:0051\|050D:845A\|0BDA:8174\|13D3:3325\|13D3:3310\|13D3:3341\|13D3:3340\|13D3:3339\|04F2:AFF6\|04F2:AFF5\|04F2:AFF2\|0CDE:0030\|14B2:3302\|14B2:3301\|14B2:3300\|0DF6:0064\|0DF6:004C\|0DF6:0049\|0DF6:0058\|2019:4901\|2019:ED18\|13D3:3306\|0E66:0015\|06F8:E031\|1740:9605\|7392:7612\|07D1:3303\|07D1:3300\|07D1:3302\|050D:815F\|13D3:3309\|13D3:3336\|13D3:3335\|13D3:3334\|13D3:3333\|13D3:3342\|13D3:3311\|13D3:3323\|0EB0:9061\|1B75:8172\|0BDA:8192\|0BDA:8172\|0BDA:8175\|25D4:4CAB\|25D4:4CA1\|20F4:646B\|1690:0752\|0BDA:5077\|177F:0154\|0DF6:0063\|0DF6:005D\|0DF6:005B\|0DF6:004B\|0DF6:0059\|0DF6:0045\|0DF6:0057\|2019:ED16\|2019:AB28\|0789:0167\|06F8:E032\|06F8:E034\|0E66:0016\|1740:9603\|7392:7611\|07D1:3306\|2001:3306\|07AA:0047\|050D:11F1\|050D:945A\|0B05:1791\|0B05:1786\|1B75:8171\|083A:C512\|07B8:8188\|0BDA:C512\|0BDA:C047\|0BDA:8713\|0BDA:8712\|0BDA:8173\|0BDA:8171' ; then
driver=8192su
# check for rtl8812au compatible driver
elif cat .lsusb | grep -i '0846:9054\|20F4:809B\|20F4:809A\|2357:0106\|7392:A833\|7392:A834\|056E:400D\|056E:400B\|0B05:1853\|0B05:1852\|0B05:1817\|2001:331A\|0BDA:8813\|2357:0120\|2357:0122\|2357:011F\|2357:011E\|3823:6249\|056E:4007\|0411:029B\|0846:9052\|2019:AB32\|0411:0242\|056E:400F\|056E:400E\|0E66:0023\|2001:3318\|2001:3314\|04BB:0953\|7392:A813\|7392:A812\|7392:A811\|0BDA:0823\|0BDA:0820\|0BDA:A811\|0BDA:8822\|0BDA:0821\|0BDA:0811\|2604:0012\|148F:9097\|050D:1109\|0411:025D\|20F4:805B\|2357:0122\|2357:010F\|2357:010E\|2357:0115\|2357:010D\|2357:0103\|2357:0101\|13B1:003F\|2001:3316\|2001:3315\|2001:3313\|2001:330E\|0846:9051\|07B8:8812\|2019:AB30\|1740:0100\|1058:0632\|0586:3426\|0E66:0022\|0B05:17D2\|0409:0408\|0789:016E\|04BB:0952\|0DF6:0074\|7392:A822\|050D:1106\|0BDA:881C\|0BDA:881B\|0BDA:881A\|0BDA:8812' ; then
driver=8812au
# check for rtl8821cu compatible driver
elif cat .lsusb | grep -i '2001:331D\|0BDA:2006\|0BDA:8811\|0BDA:C811\|0BDA:C82B\|0BDA:C82A\|0BDA:C820\|0BDA:C821\|0BDA:B820\|0BDA:B82B' ; then
driver=8821cu
# check for rtl8822bu compatible driver
elif cat .lsusb | grep -i '13B1:0043\|2001:331E\|0846:9055\|20F4:808A\|0E66:0025\|2357:012D\|2357:0138\|2357:0115\|2001:331C\|0B05:1841\|0B05:184C\|0B05:1812\|7392:C822\|7392:B822\|0BDA:B812\|0BDA:B82C' ; then
driver=8822bu
# check for mt7610u compatible driver
elif cat .lsusb | grep -i '0E8D:7650\|0E8D:7630\|2357:0105\|0DF6:0079\|7392:C711\|20F4:806B\|293C:5702\|057C:8502\|04BB:0951\|07B8:7610\|0586:3425\|2001:3D02\|2019:AB31\|0DF6:0075\|0B05:17DB\|0B05:17D1\|148F:760A\|148F:761A\|7392:A711\|0E8D:7610\|13B1:003E\|148F:7610' ; then
driver=mt7610
# check for mt7612u compatible driver
elif cat .lsusb | grep -i '0E8D:7662\|0E8D:7632\|0E8D:7612\|0B05:17C9\|045E:02E6\|0B05:17EB\|0846:9053\|0B05:180B\|0846:9014\|7392:B711\|057C:8503\|0E8D:761B' ; then
driver=mt7612
fi
if [[ ! $driver ]] ; then
echo "unrecognised."
echo
echo "**** Unable to identify your wifi module ****"
echo
echo "The script only works for wifi modules using the rtl8188eu, rtl8188fu, rtl8192eu, rtl8812au, rtl8821cu, 8822bu, mt7610 and mt7612 drivers."
echo
echo "Looking for your wifi module the script detected the following USB devices:-"
echo
cat .lsusb
echo
echo "If you are certain your module uses one of the drivers the script installs check the output of command"
echo "'lsusb' shows your wifi module. If lsusb shows your wifi module try running the script again. If the"
echo "script fails to detect your wifi module again the driver may need updating to add your module USB id."
echo
echo "If lsusb does not show your wifi module you will need to resolve that issue before the script can be"
echo "used to install the driver you need."
echo
exit 1
else
echo
echo "And it uses the $driver driver."
echo
fi
}
check_driver() {
#check Pi type
Pi=""
echo
echo -n "Your Pi revision number is "
awk '/^Revision/ {sub("^100", "", $3); print $3}' /proc/cpuinfo > Pirevno
# check for Pi 0 or 1
if cat Pirevno | grep -i '0010\|0013\|900032' ; then
echo "You have a Pi B+ v1.2"
Pi=1
elif cat Pirevno | grep -i '0012\|0015\|900021' ; then
echo "You have a Pi A+ v1.1"
Pi=1
elif cat Pirevno | grep -i '900092\|920092' ; then
echo "You have a Pi 0 v1.2"
Pi=1
elif cat Pirevno | grep -i '900093\|920093' ; then
echo "You have a Pi 0 v1.3"
Pi=1
elif cat Pirevno | grep -i '9000c1' ; then
echo "You have a Pi 0 W v1.1"
Pi=1
elif cat Pirevno | grep -i '0002\|0003' ; then
echo "You have a Pi B v1.0"
Pi=1
elif cat Pirevno | grep -i '0004\|0005\|0006' ; then
echo "You have a Pi B v2.0"
Pi=1
elif cat Pirevno | grep -i '0007\|0008\|0009' ; then
echo "You have a Pi A v2.0"
Pi=1
elif cat Pirevno | grep -i '000D\|000E\|000F' ; then
echo "You have a Pi B v2.0"
Pi=1
# check for Pi 2 or 3
elif cat Pirevno | grep -i 'a01040' ; then
echo "You have a Pi 2B v1.0"
Pi=2
elif cat Pirevno | grep -i 'a01041\|a21041' ; then
echo "You have a Pi 2B v1.1"
Pi=2
elif cat Pirevno | grep -i 'a22042' ; then
echo "You have a Pi 2B v1.2"
Pi=2
elif cat Pirevno | grep -i 'a02082\|a22082\|a32082\|a52082' ; then
echo "You have a Pi 3B v1.2"
Pi=2
elif cat Pirevno | grep -i 'a22083' ; then
echo "You have a Pi 3B v1.3"
Pi=2
elif cat Pirevno | grep -i 'a020d3' ; then
echo "You have a Pi 3B+ v1.3"
Pi=2
elif cat Pirevno | grep -i '9020e0' ; then
echo "You have a Pi 3A+ v1.0"
Pi=2
# check for Pi 4
elif cat Pirevno | grep -i 'a03111\|b03111\|c03111' ; then
echo "You have a Pi 4 v1.1"
Pi=4
elif cat Pirevno | grep -i 'a03112\|b03112\|c03112' ; then
echo "You have a Pi 4 v1.2"
Pi=4
elif cat Pirevno | grep -i 'b03114\|c03114\|d03114' ; then
echo "You have a Pi 4 v1.4"
Pi=4
elif cat Pirevno | grep -i 'c03130' ; then
echo "You have a Pi 400 v1.0"
Pi=4
# check for Pi CM
elif cat Pirevno | grep -i '0011\|0014' ; then
echo "You have a Pi CM1 v1.0"
Pi=1
elif cat Pirevno | grep -i '900061' ; then
echo "You have a Pi CM v1.1"
Pi=2
elif cat Pirevno | grep -i 'a020a0\|a220a0' ; then
echo "You have a Pi CM3 v1.0"
Pi=2
elif cat Pirevno | grep -i 'a02100' ; then
echo "You have a Pi CM3+ v1.0"
Pi=2
else
echo "Processor type unknown - you do not appear to be running this script on a Raspberry Pi. Exiting the script"
exit 1
fi
if [[ $kernelcommit == "rpi-update" ]] ; then
rpi_firmware_commit_id=master
elif [[ $kernelcommit ]] ; then
rpi_firmware_commit_id=$kernelcommit
fi
if [[ $kernelcommit ]] ; then
# check if Pi4, Pi2 B or earlier version of Pi and select the relevant kernel image
if [[ $Pi == 4 ]] ; then
uname -r > .kname
if cat .kname | grep -i "\-v8" ; then
image=kernel8.img
uname=uname_string8
else
image=kernel7l.img
uname=uname_string7l
fi
rm .kname
elif [[ $Pi == 2 ]] ; then
image=kernel7.img
uname=uname_string7
elif [[ $Pi == 1 ]] ; then
image=kernel.img
uname=uname_string
fi
echo -n "Please wait ... checking the kernel revision and build you will have after running command 'sudo rpi-update"
if [[ $kernelcommit != "rpi-update" ]] ; then
echo " $kernelcommit'."
else
echo "'."
fi
# download uname string if it exists
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/raw/$rpi_firmware_commit_id/$uname -O .uname_string) ; then
# download the relevant kernel image if uname_string doesn't exist
if ! (wget -q https://github.com/Hexxeh/rpi-firmware/raw/$rpi_firmware_commit_id/$image -O .kernel) ; then
echo "Invalid commit-id, kernel not available for your version of the Pi, Pi $pi."
exit 1
fi
# extract uname_string from kernel image
strings -n 10 .kernel | grep "Linux version" > .uname_string
# create kernel image with uname_string if the current kernel version doesn't include it
if [ ! -s .uname_string ] ; then
if [ ! -f /usr/bin/mkknlimg1 ] ; then
if [ -f /usr/bin/mkknlimg ] ; then
rm /usr/bin/mkknlimg
fi
wget -q http://downloads.fars-robotics.net/mkknlimg1 -O /usr/bin/mkknlimg1
chmod +x /usr/bin/mkknlimg1
fi
mkknlimg1 .kernel .kernel1
mv .kernel1 .kernel
strings -n 10 .kernel | grep "Linux version" > .uname_string
fi
fi
kernel=$(cat .uname_string | awk '{print $3}' | tr -d '+')
build=$(grep -Po '(?<=#)[^[]*' .uname_string | awk '{print $1}')
echo
if [[ $kernelcommit == "rpi-update" ]] ; then
echo -n "Running command 'sudo rpi-update"
elif [[ $kernelcommit ]] ; then
echo -n "Running command 'sudo rpi-update $kernelcommit"
fi
echo "' will load:"
echo
echo " kernel revision = $kernel+"
echo " kernel build = #$build"
echo
fi
echo -n "Checking for a $driver wifi driver module"
if [[ $kernelcommit ]] ; then
if [[ $kernelcommit == "rpi-update" ]] ; then
echo " if you run command 'sudo rpi-update'."
else
echo " if you run command 'sudo rpi-update $rpi_firmware_commit_id'."
fi
else
echo " for your current kernel."
fi
if (wget --spider -o .wgetlog http://downloads.fars-robotics.net/wifi-drivers/$driver\-drivers/$driver\-$kernel\-$build.tar.gz) ; then
echo "There is a driver module available for this kernel revision."
else
if cat .wgetlog | grep -iq "404 Not Found" ; then
echo "A driver does not exist for this update."
else
echo "The script cannot access fars-robotics to check a driver is available."
fi
exit 2
fi
}
install_driver() {
echo "Downloading the $driver driver, $driver-$kernel-$build.tar.gz."
if (wget -q http://downloads.fars-robotics.net/wifi-drivers/$driver\-drivers/$driver\-$kernel\-$build.tar.gz -O wifi-driver.tar.gz) ; then
echo "Installing the $driver driver."
echo
tar xzf wifi-driver.tar.gz
rm install.sh > /dev/null 2>&1
module_dir="/lib/modules/$kernel+/kernel/drivers/net/wireless"
if [ -f RT2870STA.dat ] ; then
mkdir -p /etc/Wireless/RT2870STA/
chown root:root RT2870STA.dat
mv RT2870STA.dat /etc/Wireless/RT2870STA/
if [ -f 95-ralink.rules ] ; then
mv 95-ralink.rules /etc/udev/rules.d/
elif [ -f /etc/udev/rules.d/95-ralink.rules ] ; then
rm /etc/udev/rules.d/95-ralink.rules
fi
fi
if [ -f mt7662u_sta.ko ] ; then
rm $module_dir/mt7612u* > /dev/null 2>&1
rm /lib/firmware/mt7662* > /dev/null 2>&1
driver1=mt7662u_sta
if ! grep -q "coherent_pool=" /boot/cmdline.txt ; then
echo "adding 'coherent_pool=2M' to file /boot/cmdline.txt"
sed -i 's/$/ coherent_pool=2M/' /boot/cmdline.txt
else
echo "'coherent_pool=' already intalled in file /boot/cmdline.txt"
fi
elif [ -f mt7612u.ko ] ; then
rm $module_dir/mt7662u* > /dev/null 2>&1
driver1=mt7612u
chown root:root *.bin
chmod 644 *.bin
mv *.bin /lib/firmware
elif [ -f mt7610u_sta.ko ] ; then
rm $module_dir/mt7610u* > /dev/null 2>&1
driver1=mt7610u_sta
elif [ -f mt7610u.ko ] ; then
rm $module_dir/mt7610u* > /dev/null 2>&1
driver1=mt7610u
chown root:root *.bin
chmod 644 *.bin
mv *.bin /lib/firmware
elif [ -f 8822bu.ko ] ; then
driver1=8822bu
elif [ -f 8821cu.ko ] ; then
driver1=8821cu
elif [ -f 8812au.ko ] ; then
driver1=8812au
elif [ -f 8192eu.ko ] ; then
driver1=8192eu
elif [ -f r92su.ko ] ; then
driver1=r92su
elif [ -f 8188eu.ko ] ; then
driver1=8188eu
elif [ -f 8188fu.ko ] ; then
driver1=8188fu
elif [ -f rtl8188fu.ko ] ; then
driver1=rtl8188fu
rm $module_dir/$driver.ko > /dev/null 2>&1
chown root:root rtl8188fufw.bin
chmod 644 rtl8188fufw.bin
mv rtl8188fufw.bin /lib/firmware/rtlwifi/.
fi
if [ -f $driver1.conf ] ; then
echo "Installing driver config file $driver1.conf."
echo "mv $driver1.conf /etc/modprobe.d/."
chown root:root $driver1.conf
chmod 644 $driver1.conf
mv $driver1.conf /etc/modprobe.d/.
fi
if [ -f blacklist-mt76x2u.conf ] ; then
echo "Installing file to blacklist built-in mt7612 driver."
echo "mv blacklist-mt76x2u.conf /etc/modprobe.d/."
chown root:root blacklist-mt76x2u.conf
chmod 644 blacklist-mt76x2u.conf
mv blacklist-mt76x2u.conf /etc/modprobe.d/.
fi
echo "Installing driver module $driver1.ko."
echo "install -p -m 644 $driver1.ko $module_dir"
chown root:root $driver1.ko
chmod 644 $driver1.ko
install -p -m 644 $driver1.ko $module_dir
depmod $kernel+
rm $driver1.ko
if [[ $kernelcommit ]] ; then
echo "Syncing changes to disk"
sync
echo "You will need to reboot to load the driver."
elif (lsmod | grep $driver1 > /dev/null) ; then
echo "Syncing changes to disk"
sync
echo "A version of the $driver driver is already loaded and running."
echo "You will need to reboot to load the new driver, $driver1.ko."
else
echo "Loading and running the $driver driver, $driver1.ko."
modprobe $driver1
fi
else
echo
echo "A driver does not exist for this kernel."
fi
}
display_current() {
echo
echo "Your current kernel revision = $kernel+"
echo "Your current kernel build = #$build"
echo
}
tmpdir=$(mktemp -d)
trap "\rm -rf $tmpdir" EXIT
cd $tmpdir
#initialise some variables
command=$0
option=$1
kernelcommit=$2
Pirevno=""
driver=""
kernel=$(uname -r | tr -d '+')
build=${build:-$(uname -v | awk '{print $1}' | tr -d '#')}
if [[ ${EUID} -ne 0 ]]; then
echo " !!! This tool must be run as root"
exit 1
fi
echo
echo " *** Raspberry Pi wifi driver installer by MrEngman."
#if [[ ${UPDATE_SELF} -ne 0 ]]; then
# update_self
#fi
#echo
#echo "This script installs drivers for Raspbian."
#if ! cat /etc/os-release | grep -iq 'ID=raspbian' ; then
# echo "You do not appear to be using a Raspbian OS so exiting the script."
# echo
# exit 2
#fi
case "$1" in
8188eu|8188fu|8192eu|8192su|8812au|8821cu|8822bu|mt7610|mt7612)
driver=$1
display_current
check_driver
install_driver
;;
-c|--check)
case "$2" in
8188eu|8188fu|8192eu|8192su|8812au|8821cu|8822bu|mt7610|mt7612)
driver=$2
kernelcommit=$3
;;
esac
display_current
if [ ! $driver ] ; then
fetch_driver
fi
check_driver
;;
-u|--update)
case "$2" in
8188eu|8188fu|8192eu|8192su|8812au|8821cu|8822bu|mt7610|mt7612)
driver=$2
kernelcommit=$3
;;
esac
display_current
if [ ! $driver ] ; then
fetch_driver
fi
check_driver
install_driver
;;
-h|--help)
display_help
exit 0
;;
"")
display_current
fetch_driver
check_driver
install_driver
;; # proceed to install
*)
echo "unknown command: $1" >&2
echo
read -n1 -r -p "Press any key to continue..."
display_help
exit 1
;;
esac
exit 0
@MRDGH2821
Copy link

MRDGH2821 commented Aug 4, 2022

Somehow this fork is not working for me, I'm getting error -

*** Raspberry Pi wifi driver installer by MrEngman
*** Performing self update
stat: cannot statx 'install-wifi': No such file or directory found
chmod: missing operand after 'install-wifi.tmp'
Try 'chmod --help' for more information.
!!! Failed: Error while trying to set mode on install-wifi.tmp

@antani
Copy link

antani commented Nov 15, 2022

Not sure how refreshed this script is but

Your wifi module is Bus 001 Device 004: ID 2357:0109 TP-Link TL WN823N RTL8192EU
And it uses the 8192eu driver.
Your Pi revision number is 000e
You have a Pi B v2.0
Checking for a 8192eu wifi driver module for your current kernel.
A driver does not exist for this update

@d3vCr0w
Copy link

d3vCr0w commented Jan 8, 2023

Is there any other place to get the drivers from?
It seems like http://downloads.fars-robotics.net/ is down.

@greatidea1
Copy link

Is there any other place to get the drivers from? It seems like http://downloads.fars-robotics.net/ is down.

Same problem here, not sure if anybody else has a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment