standby: add systemd standby-actions script for ccimx6/ccimx6qp platforms

Even though systemd support is not yet available for these platforms, add the
scripts so bitbake doesn't fail when building the busybox package.

https://jira.digi.com/browse/DEL-6565

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2019-04-25 11:29:56 +02:00
parent f1ce4bfbc8
commit 5a14bd9666
2 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,64 @@
#!/bin/sh
#===============================================================================
#
# standby-actions
#
# Copyright (C) 2019 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: manage interfaces before suspending and after resuming from
# suspend
#
#===============================================================================
if [ "${1}" == "pre" ]; then
# Stop NetworkManager before suspend
systemctl stop NetworkManager
# Suspend wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done
echo ${RESUME_IFACES} > /tmp/suspend_wlan_ifaces
grep -qs '^wlan' /proc/modules && rmmod wlan
fi
# Suspend bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then
hciconfig hci0 2>&1 | grep -qs UP && touch /tmp/up_bt_on_resume
systemctl stop bluetooth
systemctl stop bluetooth-init
fi
elif [ "${1}" == "post" ]; then
# Resume wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
# Trigger wireless module loading event, and wait until the interface exists
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d050A"
timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Bring up the interfaces that were brought down on suspend
for i in $(cat /tmp/suspend_wlan_ifaces | tr ' ' '\n' | sort); do
grep -qs "^${i}" /var/run/ifstate || ifup "${i}"
done
rm -f /tmp/suspend_wlan_ifaces
fi
# Resume NetworkManager after suspend
systemctl start NetworkManager
# Resume bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then
if [ -e "/tmp/up_bt_on_resume" ]; then
systemctl start bluetooth-init
systemctl start bluetooth
rm -f /tmp/up_bt_on_resume
fi
fi
fi

View File

@ -0,0 +1,64 @@
#!/bin/sh
#===============================================================================
#
# standby-actions
#
# Copyright (C) 2019 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# !Description: manage interfaces before suspending and after resuming from
# suspend
#
#===============================================================================
if [ "${1}" == "pre" ]; then
# Stop NetworkManager before suspend
systemctl stop NetworkManager
# Suspend wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done
echo ${RESUME_IFACES} > /tmp/suspend_wlan_ifaces
grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core
fi
# Suspend bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then
hciconfig hci0 2>&1 | grep -qs UP && touch /tmp/up_bt_on_resume
systemctl stop bluetooth
systemctl stop bluetooth-init
fi
elif [ "${1}" == "post" ]; then
# Resume wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
# Trigger wireless module loading event, and wait until the interface exists
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301"
timeout -t 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Bring up the interfaces that were brought down on suspend
for i in $(cat /tmp/suspend_wlan_ifaces | tr ' ' '\n' | sort); do
grep -qs "^${i}" /var/run/ifstate || ifup "${i}"
done
rm -f /tmp/suspend_wlan_ifaces
fi
# Resume NetworkManager after suspend
systemctl start NetworkManager
# Resume bluetooth interface
if [ -d "/proc/device-tree/bluetooth" ]; then
if [ -e "/tmp/up_bt_on_resume" ]; then
systemctl start bluetooth-init
systemctl start bluetooth
rm -f /tmp/up_bt_on_resume
fi
fi
fi