reduce wifi reconnection time after deep sleep #150

master
Maarten van Gompel 3 years ago
parent 861eac8cca
commit 00cf2ba3ec
  1. 5
      Makefile
  2. 2
      configs/networkmanager/resetscaninterval.sh
  3. 6
      programs/sxmo_screenlock.c
  4. 2
      scripts/core/sxmo_postwake.sh
  5. 11
      scripts/core/sxmo_resetscaninterval.sh

@ -44,8 +44,9 @@ install: $(PROGRAMS)
install -D -m 0644 -t $(DESTDIR)$(PREFIX)/share/applications/ configs/xdg/mimeapps.list
mkdir -p $(PREFIX)/etc/NetworkManager/dispatcher.d
cp configs/networkmanager/updatestatusbar.sh $(PREFIX)/etc/NetworkManager/dispatcher.d/10-updatestatusbar.sh
mkdir -p $(DESTDIR)/etc/NetworkManager/dispatcher.d
install -D -m 0755 -T configs/networkmanager/updatestatusbar.sh $(DESTDIR)/etc/NetworkManager/dispatcher.d/10-updatestatusbar.sh
install -D -m 0755 -T configs/networkmanager/resetscaninterval.sh $(DESTDIR)/etc/NetworkManager/dispatcher.d/20-resetscaninterval.sh
# Bin
install -D -t $(DESTDIR)$(PREFIX)/bin scripts/*/*

@ -0,0 +1,2 @@
#!/bin/sh
sxmo_resetscaninterval.sh

@ -375,10 +375,14 @@ syncstate()
writefile(powerstatefile, "mem");
//---- program blocks here due to sleep ----- //
// Just woke up again
fprintf(stderr, "Woke up\n");
fprintf(stderr, "Resetting usb connection to the modem\n");
writefile("/sys/bus/usb/drivers/usb/unbind", "3-1");
writefile("/sys/bus/usb/drivers/usb/bind", "3-1");
fprintf(stderr, "Woke up\n");
fprintf(stderr, "Lower scan interval for quicker reconnection to wireless network\n");
writefile("/sys/module/8723cs/parameters/rtw_scan_interval_thr", "1200"); //ms
//^-- this will be undone again by a networkmanager hook after connection has been established
// or by a delayed script if no connection can be established after a while (to conserve battery)
if (waketime > 0) {
rtcresult = checkrtcwake();
} else {

@ -4,6 +4,8 @@
sxmo_statusbarupdate.sh
(sleep 15 && sxmo_resetscaninterval.sh) &
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/postwake" ]; then
"$XDG_CONFIG_HOME/sxmo/hooks/postwake"
fi

@ -0,0 +1,11 @@
#!/bin/sh
# this script resets the wireless scan interval (value is in ms)
# it is invoked with a delay after waking from sleep
# to prevent the scan interval from being too quick, and thus
# too battery consuming, whilst no networks are found
# the kernel parameter must be writable for the user
# or this script must have the setsuid bit set!
echo 16000 > /sys/module/8723cs/parameters/rtw_scan_interval_thr
Loading…
Cancel
Save