cc93: standby: decople bluetooth from WiFi actions

Do not make conditional the bluetooth actions on WiFi, as they can be
treated independently.

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2024-01-15 09:10:28 +01:00
parent 65750ce196
commit efb80f3806
1 changed files with 26 additions and 18 deletions

View File

@ -3,7 +3,7 @@
# #
# standby-actions # standby-actions
# #
# Copyright (C) 2023 by Digi International Inc. # Copyright (C) 2023, 2024 by Digi International Inc.
# All rights reserved. # All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify it # This program is free software; you can redistribute it and/or modify it
@ -18,39 +18,47 @@
RESUME_ACTIONS="/tmp/resume_actions" RESUME_ACTIONS="/tmp/resume_actions"
actions_needed() { wifi_actions_needed() {
[ -d "/proc/device-tree/wireless" ] && [ ! -e "/sys/firmware/devicetree/base/soc@0/bus@42800000/mmc@428b0000/keep-power-in-suspend" ] [ -d "/proc/device-tree/wireless" ] && [ ! -e "/sys/firmware/devicetree/base/soc@0/bus@42800000/mmc@428b0000/keep-power-in-suspend" ]
} }
bt_actions_needed() {
systemctl -q is-active bluetooth-init
}
if [ "${1}" = "pre" ]; then if [ "${1}" = "pre" ]; then
rm -f "${RESUME_ACTIONS}"
# Stop NetworkManager before suspend # Stop NetworkManager before suspend
systemctl stop NetworkManager systemctl stop NetworkManager
if actions_needed; then if wifi_actions_needed; then
rm -f "${RESUME_ACTIONS}"
for iface in wlan0 uap0 wfd0; do for iface in wlan0 uap0 wfd0; do
if grep -qs ${iface} /var/run/ifstate; then if grep -qs ${iface} /var/run/ifstate; then
ifdown ${iface} && echo "ifup ${iface}" >> "${RESUME_ACTIONS}" ifdown ${iface} && echo "ifup ${iface}" >> "${RESUME_ACTIONS}"
fi fi
done done
rmmod moal {
rmmod mlan echo "sleep 0.5"
echo "/etc/udev/scripts/load_iw612.sh"
} >> "${RESUME_ACTIONS}"
modprobe -r moal
fi
if systemctl is-active bluetooth-init; then if bt_actions_needed; then
# bluetooth service relies on bluetooth-init service, so stop/start it unconditionally # bluetooth service relies on bluetooth-init service, so stop/start it unconditionally
echo "systemctl start bluetooth-init" >> "${RESUME_ACTIONS}" {
echo "systemctl start bluetooth" >> "${RESUME_ACTIONS}" echo "systemctl start bluetooth-init"
echo "systemctl start bluetooth"
} >> "${RESUME_ACTIONS}"
systemctl stop bluetooth-init systemctl stop bluetooth-init
systemctl stop bluetooth systemctl stop bluetooth
fi fi
fi
elif [ "${1}" = "post" ]; then elif [ "${1}" = "post" ]; then
if actions_needed; then if [ -f ${RESUME_ACTIONS} ]; then
sleep 0.5 chmod +x "${RESUME_ACTIONS}"
/etc/udev/scripts/load_iw612.sh eval "${RESUME_ACTIONS}"
sh "${RESUME_ACTIONS}"
rm -f "${RESUME_ACTIONS}" rm -f "${RESUME_ACTIONS}"
fi fi