suspend: bring bluetooth interface down and up on suspend
https://jira.digi.com/browse/DEL-3858 Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
33073a1589
commit
3877b2a59f
|
|
@ -20,6 +20,8 @@ syspower="/sys/power/state"
|
||||||
lockfile="/var/lock/${scriptname}.lock"
|
lockfile="/var/lock/${scriptname}.lock"
|
||||||
lockfd="9"
|
lockfd="9"
|
||||||
|
|
||||||
|
BT_INIT="/etc/init.d/bluetooth-init"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "\nSuspend system to RAM memory\n"
|
printf "\nSuspend system to RAM memory\n"
|
||||||
printf "\nUsage: ${scriptname} [OPTIONS]\n
|
printf "\nUsage: ${scriptname} [OPTIONS]\n
|
||||||
|
|
@ -28,15 +30,24 @@ usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend_interfaces() {
|
suspend_interfaces() {
|
||||||
|
# Suspend wireless interface
|
||||||
if grep -qs '^wlan0' /var/run/ifstate; then
|
if grep -qs '^wlan0' /var/run/ifstate; then
|
||||||
ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && rmmod ath6kl_sdio
|
ifdown wlan0 && up_wlan_on_resume="1" && sleep 0.5 && rmmod ath6kl_sdio
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Suspend bluetooth interface
|
||||||
|
hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1"
|
||||||
|
${BT_INIT} stop >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
resume_interfaces() {
|
resume_interfaces() {
|
||||||
|
# Resume wireless interface
|
||||||
if ! grep -qs '^wlan0' /var/run/ifstate; then
|
if ! grep -qs '^wlan0' /var/run/ifstate; then
|
||||||
[ -n "${up_wlan_on_resume}" ] && modprobe ath6kl_sdio && sleep 0.5 && ifup wlan0
|
[ -n "${up_wlan_on_resume}" ] && modprobe ath6kl_sdio && sleep 0.5 && ifup wlan0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Resume bluetooth interface
|
||||||
|
[ -n "${up_bt_on_resume}" ] && ${BT_INIT} start >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
enter_critical_section() {
|
enter_critical_section() {
|
||||||
|
|
@ -20,6 +20,8 @@ syspower="/sys/power/state"
|
||||||
lockfile="/var/lock/${scriptname}.lock"
|
lockfile="/var/lock/${scriptname}.lock"
|
||||||
lockfd="9"
|
lockfd="9"
|
||||||
|
|
||||||
|
BT_INIT="/etc/init.d/bluetooth-init"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "\nSuspend system to RAM memory\n"
|
printf "\nSuspend system to RAM memory\n"
|
||||||
printf "\nUsage: ${scriptname} [OPTIONS]\n
|
printf "\nUsage: ${scriptname} [OPTIONS]\n
|
||||||
|
|
@ -28,18 +30,27 @@ usage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend_interfaces() {
|
suspend_interfaces() {
|
||||||
|
# Suspend wireless interface
|
||||||
if grep -qs '^wlan0' /var/run/ifstate; then
|
if grep -qs '^wlan0' /var/run/ifstate; then
|
||||||
ifdown wlan0 && up_wlan_on_resume="1"
|
ifdown wlan0 && up_wlan_on_resume="1"
|
||||||
fi
|
fi
|
||||||
if grep -qs '^wlan' /proc/modules; then
|
if grep -qs '^wlan' /proc/modules; then
|
||||||
rmmod wlan
|
rmmod wlan
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Suspend bluetooth interface
|
||||||
|
hciconfig hci0 2>&1 | grep -qs UP && up_bt_on_resume="1"
|
||||||
|
${BT_INIT} stop >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
resume_interfaces() {
|
resume_interfaces() {
|
||||||
|
# Resume wireless interface
|
||||||
if ! grep -qs '^wlan0' /var/run/ifstate; then
|
if ! grep -qs '^wlan0' /var/run/ifstate; then
|
||||||
[ -n "${up_wlan_on_resume}" ] && ifup wlan0
|
[ -n "${up_wlan_on_resume}" ] && ifup wlan0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Resume bluetooth interface
|
||||||
|
[ -n "${up_bt_on_resume}" ] && ${BT_INIT} start >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
enter_critical_section() {
|
enter_critical_section() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue