From 3877b2a59fa2ff3872d0499c96cb7360dbb2c5d7 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Tue, 14 Mar 2017 18:27:52 +0100 Subject: [PATCH] suspend: bring bluetooth interface down and up on suspend https://jira.digi.com/browse/DEL-3858 Signed-off-by: Javier Viguera --- .../busybox/busybox-1.24.1/{ => ccimx6}/suspend | 11 +++++++++++ .../busybox/busybox-1.24.1/ccimx6ul/suspend | 11 +++++++++++ 2 files changed, 22 insertions(+) rename meta-digi-dey/recipes-core/busybox/busybox-1.24.1/{ => ccimx6}/suspend (85%) diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend similarity index 85% rename from meta-digi-dey/recipes-core/busybox/busybox-1.24.1/suspend rename to meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend index ec0da8101..6888311e4 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6/suspend @@ -20,6 +20,8 @@ syspower="/sys/power/state" lockfile="/var/lock/${scriptname}.lock" lockfd="9" +BT_INIT="/etc/init.d/bluetooth-init" + usage() { printf "\nSuspend system to RAM memory\n" printf "\nUsage: ${scriptname} [OPTIONS]\n @@ -28,15 +30,24 @@ usage() { } suspend_interfaces() { + # Suspend wireless interface if grep -qs '^wlan0' /var/run/ifstate; then ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && rmmod ath6kl_sdio fi + + # Suspend bluetooth interface + hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" + ${BT_INIT} stop >/dev/null } resume_interfaces() { + # Resume wireless interface if ! grep -qs '^wlan0' /var/run/ifstate; then [ -n "${up_wlan_on_resume}" ] && modprobe ath6kl_sdio && sleep 0.5 && ifup wlan0 fi + + # Resume bluetooth interface + [ -n "${up_bt_on_resume}" ] && ${BT_INIT} start >/dev/null } enter_critical_section() { diff --git a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend index cc460bee2..e213f45fe 100755 --- a/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend +++ b/meta-digi-dey/recipes-core/busybox/busybox-1.24.1/ccimx6ul/suspend @@ -20,6 +20,8 @@ syspower="/sys/power/state" lockfile="/var/lock/${scriptname}.lock" lockfd="9" +BT_INIT="/etc/init.d/bluetooth-init" + usage() { printf "\nSuspend system to RAM memory\n" printf "\nUsage: ${scriptname} [OPTIONS]\n @@ -28,18 +30,27 @@ usage() { } suspend_interfaces() { + # Suspend wireless interface if grep -qs '^wlan0' /var/run/ifstate; then ifdown wlan0 && up_wlan_on_resume="1" fi if grep -qs '^wlan' /proc/modules; then rmmod wlan fi + + # Suspend bluetooth interface + hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1" + ${BT_INIT} stop >/dev/null } resume_interfaces() { + # Resume wireless interface if ! grep -qs '^wlan0' /var/run/ifstate; then [ -n "${up_wlan_on_resume}" ] && ifup wlan0 fi + + # Resume bluetooth interface + [ -n "${up_bt_on_resume}" ] && ${BT_INIT} start >/dev/null } enter_critical_section() {