pandora-scripts: BT suspend fix from urjaman
authorGrazvydas Ignotas <notasas@gmail.com>
Sat, 27 Feb 2016 01:18:01 +0000 (03:18 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 27 Feb 2016 01:18:01 +0000 (03:18 +0200)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_power.sh

index 5a4ca0a..d710285 100644 (file)
@@ -5,7 +5,7 @@ COMPATIBLE_MACHINE = "omap3-pandora"
 
 RDEPENDS = "bash sed gawk grep zenity"
 
-PR = "r165"
+PR = "r166"
 
 SRC_URI = " \
           file://op_bright.sh \
index 9b0e1b2..0401d07 100644 (file)
@@ -25,13 +25,15 @@ fi
 debug && echo "powerstate=$powerstate"
 
 suspend_net() {
-       hcistate=$(hciconfig hci0 | grep DOWN)
-       if [ $hcistate ]; then
-               echo "down" > /tmp/hcistate
+       # This is kernel 3.x only,
+       # but ignored since 2.6 only has lowpower anyways (no suspend)
+       if (ps -A | grep -q hciattac[h]); then
+               touch /tmp/bt-state-up
+               /usr/pandora/scripts/op_bluetooth_work.sh 0
        else
-               echo "up" > /tmp/hcistate
-               hciconfig hci0 down
+               rm -f /tmp/bt-state-up
        fi
+
        wlstate=$(lsmod | grep -m1 wl1251)
        if [ -z "$wlstate" ]; then
                echo "down" > /tmp/wlstate
@@ -44,8 +46,8 @@ suspend_net() {
 }
 
 resume_net() {
-       hcistate=$(cat /tmp/hcistate)
-       if [ "$hcistate" = "up" ]; then
+       if [ -f /tmp/bt-state-up ]; then
+               /usr/pandora/scripts/op_bluetooth_work.sh 1
                hciconfig hci0 up pscan
        fi
        wlstate=$(cat /tmp/wlstate)