Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions skeleton/SYSTEM/tg5040/bin/suspend
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,52 @@ bluetoothd_running=0
resume() {
>&2 echo "Resuming from suspend..."

>&2 echo "Unblocking wireless..."
echo 1 >/sys/class/rfkill/rfkill0/state || true
# >&2 echo "Unblocking wireless..."
# echo 1 >/sys/class/rfkill/rfkill0/state || true

if [ "$wpa_running" -eq 1 ]; then
>&2 echo "Starting wpa_supplicant..."
wpa_supplicant -B -iwlan0 -Dnl80211 -c/etc/wifi/wpa_supplicant.conf -I/etc/wifi/wpa_supplicant_overlay.conf -O/etc/wifi/sockets || true
udhcpc -i wlan0 &
fi
# if [ "$wpa_running" -eq 1 ]; then
# >&2 echo "Starting wpa_supplicant..."
# wpa_supplicant -B -iwlan0 -Dnl80211 -c/etc/wifi/wpa_supplicant.conf -I/etc/wifi/wpa_supplicant_overlay.conf -O/etc/wifi/sockets || true
# udhcpc -i wlan0 &
# fi

if [ "$hciattach_running" -eq 1 ]; then
>&2 echo "Starting hciattach..."
/etc/init.d/hciattach start || true
fi
if [ "$bluetoothd_running" -eq 1 ]; then
>&2 echo "Starting bluetoothd..."
/etc/bluetooth/bluetoothd start || true
/usr/bin/bluetoothctl power on || true
fi
# if [ "$hciattach_running" -eq 1 ]; then
# >&2 echo "Starting hciattach..."
# /etc/init.d/hciattach start || true
# fi
# if [ "$bluetoothd_running" -eq 1 ]; then
# >&2 echo "Starting bluetoothd..."
# /etc/bluetooth/bluetoothd start || true
# /usr/bin/bluetoothctl power on || true
# fi
}

main() {
trap "resume" EXIT INT TERM HUP QUIT

>&2 echo "Preparing for suspend..."

if pgrep wpa_supplicant; then
wpa_running=1
>&2 echo "Stopping wpa_supplicant..."
killall -9 wpa_supplicant
fi
ifconfig wlan0 down
# if pgrep wpa_supplicant; then
# wpa_running=1
# >&2 echo "Stopping wpa_supplicant..."
# killall -9 wpa_supplicant
# fi
# ifconfig wlan0 down

if pgrep hciattach; then
hciattach_running=1
>&2 echo "Stopping hciattach..."
/etc/init.d/hciattach stop
fi
if pgrep bluetoothd; then
bluetoothd_running=1
>&2 echo "Stopping bluetoothd..."
/etc/bluetooth/bluetoothd stop
killall -15 bluealsa
fi
# if pgrep hciattach; then
# hciattach_running=1
# >&2 echo "Stopping hciattach..."
# /etc/init.d/hciattach stop
# fi
# if pgrep bluetoothd; then
# bluetoothd_running=1
# >&2 echo "Stopping bluetoothd..."
# /etc/bluetooth/bluetoothd stop
# killall -15 bluealsa
# fi

>&2 echo "Blocking wireless..."
echo 0 >/sys/class/rfkill/rfkill0/state
# >&2 echo "Blocking wireless..."
# echo 0 >/sys/class/rfkill/rfkill0/state

>&2 echo "Suspending..."
echo mem >/sys/power/state
Expand Down