~mil/sxmo-tickets#428: 
Power button with Megapixels running sometimes locks screen

I could not be reproduce it reliably. Possibly this only happens when the lockscreen state is already confused (as it so often seems to be).

  1. Run Megapixels.
  2. Press the power button to shoot a picture.

Expected result: a picture is shot.

Actual result: blue LED turns on.

Pressing the power button again turns the blue LED of again.

Status
RESOLVED FIXED
Submitter
~murks
Assigned to
No-one
Submitted
3 years ago
Updated
2 years ago
Labels
bug

~phartman 3 years ago

Here's a patch. Not tested. But sounds like for some reason you are running megapixels even though the system is in "lock" state and not unlock state. Not sure how you managed to get into that situation, but we should probably check for it here. Also, maybe we should add megapixels to is_idle?

From 3d038ad791b6b4398db5775515f05748a8b5f077 Mon Sep 17 00:00:00 2001
From: Peter John Hartman <peterjohnhartman@gmail.com>
Date: Sun, 5 Dec 2021 08:34:28 -0600
Subject: [PATCH] fix megapixels

---
 scripts/core/sxmo_inputhandler.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/core/sxmo_inputhandler.sh b/scripts/core/sxmo_inputhandler.sh
index 1049329..190533c 100755
--- a/scripts/core/sxmo_inputhandler.sh
+++ b/scripts/core/sxmo_inputhandler.sh
@@ -44,7 +44,11 @@ fi
 if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
        case "$ACTION" in
                "powerbutton_one")
-                       lock_screen_action
+                       if echo "$WMCLASS" | grep -i "megapixels"; then
+                               sxmo_type.sh -k space
+                       else
+                               lock_screen_action
+                       fi
                        ;;
                "powerbutton_two"|"powerbutton_three")
                        lock_screen_action 2
--
2.34.1

~phartman 3 years ago*

Also, I find it helpful to disable the powerbutton_two/powerbutton_three. I find the sensitivity a little off, so I often will get a powerbutton_two when I meant one and so I'll be in an undesired lock state. You can do that via ~/.config/sxmo/hooks/inputhandler, like so:

#!/bin/sh

WMCLASS="$1"
WMNAME="$2"
ACTION="$3"

# You must exit 0 if you handled the input to not trigger default behaviors
# You must exit 1 at the end in order for sxmo_inputhandler.sh to handle the
# other behaviours

if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
# Here you could override locked input handlers
# You must exit 1 at the end to allow defaults too
case "$ACTION" in
"powerbutton_two"|"powerbutton_three")
exit 0 # disable theseĀ·
;;
esac
exit 1
fi

# Here you can handle normal input handler

# Here is an example of possible custom actions
# Please share your recipes to the community :D

case "$ACTION" in
"powerbutton_two"|"powerbutton_three")
exit 0 # don't continue to lock-screen-action -- i hate the double click
;;
esac

exit 1

~phartman REPORTED FIXED 2 years ago

I think this is fixed now in 1.8.2.

Register here or Log in to comment, or comment via email.