1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hotspot_ynh.git synced 2024-09-03 19:25:53 +02:00

feat: hot reloading wifi usb drivers

close #62
This commit is contained in:
HugoPoi 2021-03-17 01:03:07 +01:00
parent 63e4f87efd
commit 94d94648de
4 changed files with 20 additions and 0 deletions

View file

@ -26,6 +26,23 @@ function check_armbian_nonfree_conflict()
}
function hot_reload_usb_wifi_cards()
{
modulesList="acx-mac80211 ar5523 ar9170usb at76c50x-usb at76_usb ath9k_htc carl9170 orinoco_usb p54usb prism2_usb r8712u r8192s_usb r8192u_usb rndis_wlan rt2500usb rt2800usb rt2870sta rt73usb rtl8187 rtl8192cu usb8xxx vt6656_stage zd1201 zd1211rw"
modprobe --quiet --remove $modulesList || true
possibleUsbDevicesNeedingReload=$(dmesg | grep -Pio '(?<=usb )[0-9-]+(?=:.*firmware)' | sort | uniq)
for usbPath in $possibleUsbDevicesNeedingReload; do
if [[ -f "/sys/bus/usb/devices/$usbPath/authorized" ]]; then
echo "Try to reload driver for usb $usbPath" >&2
echo 0 > /sys/bus/usb/devices/$usbPath/authorized
echo 1 > /sys/bus/usb/devices/$usbPath/authorized
# Wait for driver reloading
sleep 2
fi
done
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -168,6 +168,7 @@ if [[ ! -v ip6_net ]]; then # if ip6_net not set
fi
fi
hot_reload_usb_wifi_cards
wifi_device=$(bash ../conf/iw_devices | awk -F\| '{ print $1 }')
ynh_app_setting_set --app=$app --key=multissid --value=1

View file

@ -140,6 +140,7 @@ yunohost service add $service_name --description "Creates a Wi-Fi access point"
#=================================================
ynh_script_progression --message="Starting a systemd service..."
hot_reload_usb_wifi_cards
wifi_device=$(bash ../settings/conf/iw_devices | awk -F\| '{ print $1 }')
if [[ -z $wifi_device ]]; then

View file

@ -206,6 +206,7 @@ yunohost service add $service_name --description "Creates a Wi-Fi access point"
#=================================================
ynh_script_progression --message="Starting a systemd service..."
hot_reload_usb_wifi_cards
wifi_device=$(bash ../conf/iw_devices | awk -F\| '{ print $1 }')
if [[ -z $wifi_device ]]; then