diff --git a/lib/provision.sh b/lib/provision.sh index 93fd71e..307a613 100644 --- a/lib/provision.sh +++ b/lib/provision.sh @@ -242,6 +242,9 @@ provision_install_wifi_helper() { log_warning "Couldn't set up the kiosk WiFi screen's permission - Ctrl+Alt+Super+W won't be able to connect" fi rm -f "$tmp" + # Flaky cheap dongles (RTL8188CUS...) need WiFi power saving off. + provision_install_file "etc/udev/rules.d/70-kiosk-wifi-power.rules" /etc/udev/rules.d/70-kiosk-wifi-power.rules + sudo udevadm control --reload-rules 2>/dev/null || true } provision_configure_firewall() { diff --git a/provision/files/etc/udev/rules.d/70-kiosk-wifi-power.rules b/provision/files/etc/udev/rules.d/70-kiosk-wifi-power.rules new file mode 100644 index 0000000..4064080 --- /dev/null +++ b/provision/files/etc/udev/rules.d/70-kiosk-wifi-power.rules @@ -0,0 +1,11 @@ +# Keep WiFi adapters awake. Power saving (the adapter dozing between +# packets, and the USB port suspending an idle dongle) is what makes +# cheap dongles like the Realtek RTL8188CUS drop or stall a connection. +# Both are ordinary software settings, so nothing here can harm the +# hardware: the cost is a fraction of a watt. + +# Radio power save off on every WiFi interface as it appears. +ACTION=="add", SUBSYSTEM=="net", KERNEL=="wl*", RUN+="/usr/sbin/iw dev $name set power_save off" + +# No USB autosuspend for the common RTL8188/8192 CU/CUS/RU dongles. +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8176|8177|8178|8179|817a|817b|817c|817d|817e|8191", TEST=="power/control", ATTR{power/control}="on"