Created
July 29, 2019 00:08
-
-
Save ouija/873a1d8ed697229865c7f5fa2baf5b4b to your computer and use it in GitHub Desktop.
r8723bs wifi sleep fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/bin/sh | |
while true | |
do | |
# check device wakefulness state | |
WAKE_STATE=$(dumpsys power | grep -m1 'mWakefulness' | cut -d = -f 2) | |
#echo "Wakefulness: $WAKE_STATE" | |
if [ "$WAKE_STATE" = "Asleep" ]; then | |
# disable wifi | |
WIFI=$(lsmod | grep -m1 r8723bs) | |
if [ ! -z "$WIFI" ]; then | |
svc wifi disable && rmmod r8723bs | |
fi | |
elif [ "$WAKE_STATE" = "Awake" ]; then | |
# enable wifi if not loaded | |
WIFI=$(lsmod | grep -m1 r8723bs) | |
if [ -z "$WIFI" ]; then | |
modprobe r8723bs && svc wifi enable | |
fi | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment