Commit Graph

19 Commits

Author SHA1 Message Date
Willow Barraco
7af66e1ea8 Use unit instead of nanoseconds 2023-02-24 19:21:47 +01:00
Willow Barraco
b1ab67cc89 sxmo_led.sh: Don't set exclusive flock to get values
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-02-23 17:12:38 -06:00
Willow Barraco
2868a86710 Ensure sxmo_led.sh reset leds when it finish
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-02-23 17:12:38 -06:00
Willow Barraco
b8e6cf3330 Centralize wakelock management in sxmo_wakelock.sh
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-02-23 17:12:36 -06:00
Willow Barraco
89a77e6057 Rely on /sys/power/wake_lock
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-02-23 17:11:48 -06:00
Willow Barraco
c451ea82df Simplify concurrency sxmo_led.sh check
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-02-17 05:39:31 -06:00
Stacy Harper
a2405f6d57 Fix shellspec 2022-11-15 13:41:55 +01:00
Zach DeCook
55da6d17cf get leds: don't claim a mutex to check led state
Keeps the statusbar from blinking when you open the sys menu

Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-10-05 10:54:09 -05:00
Tzafrir Cohen
50208cc145 Fix syntax error in a bc script
Signed-off-by: Tzafrir Cohen <tzafrir@debian.org>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-07-15 22:52:00 +02:00
Jami Kettunen
a813bafc01 Source scripts directly instead of using "which"
Changes since v1:
- source directly instead of using "command -v" as much as possible,
  I couldn't get the sources in deviceprofile cases to return a proper
  exit code so they still use "command -v".
- avoid leaving deviceprofile var set in interactive shells from
  sxmo_init.sh
- small fixup to warning message if deviceprofile not found

This allows Sxmo to drop an external dependency on which.

Anjan's note: This is also faster due to being a shell built-in

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-04-18 02:43:51 -04:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
de71ed7b34 Add a sxmo_uniq_exec.sh to ensure concurrent free script execution
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-02-23 05:13:36 -06:00
ArenM
d1e025f1f7 Don't wait multiple times
The wait command will wait for all process known to the shell if no
arguments are passed, so in these cases looping does nothing.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-20 10:48:24 +01:00
Stacy Harper
73636e325f Move MUTEX_NAME as first required argument
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-02-09 18:19:05 -06:00
Stacy Harper
ec6d08e91b Rework is_idle/can_suspend mutexes
It offer a "mutex" way to manage the is_idle and can_suspend status:

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh lock "Dont want to…"

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh list
    SSH is connected
    MPD is playing music
    Playing with leds
    Dont want to…

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh free "Dont want to…"

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh list
    SSH is connected
    MPD is playing music
    Playing with leds

I removed "can_suspend" and "is_idle" hooks to make one unique
"check_state_mutexes" one. This is triggered lazyly by the
idle_locker daemon.

We will tend to use "lock" and "free" action inside some scripts (check
sxmo_leds.sh and sxmo_proximitylock.sh) but for retro-compatibility and
for things like ssh session, we keep this script to periodically check
some conditions.

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh hold

    Will check if no reason are present of wait until it happen.

    $ MUTEX_NAME=can_suspend sxmo_mutex.sh holdexec echo foo

Will check if no reason are present of wait until it happen to exec the
command.
2022-02-09 19:11:24 +01:00
Peter John Hartman
230b1addf3 Convert LED_ to SXMO_LED_
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 19:05:48 +01:00
Peter John Hartman
8cc2475a69 SXMO_DISABLE_LEDS option.
This is for devices wthout LEDs.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 19:05:41 +01:00
Zach DeCook
f86fd54c14 bc: use busybox bc
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-18 13:15:54 +01:00
Stacy Harper
ad06db432b Refact: leds usage
- Use one single sxmo_led.sh script

$ sxmo_led.sh blink red
$ sxmo_led.sh blink red blue

$ sxmo_led.sh set red 100
$ sxmo_led.sh set red 100 blue 0 green 100

This script got a simple mutex check to behave consistently while
spamed.

Blinking leds now return to initial state. Make it more easy to use
with long running leds. Plus it also solve the issue of invisible
blinking led if the color already is used.

- Free leds of sxmo lock state

The goal here is to not rely on long running leds for screen lock state.

The typical use case is when the user want to lock the screen while
playing a video. Having a blue led in the eyes really is annoying in
this kind of cases.

Another issue is when the phone is in crust, then the mixup of green
+ red give a not simple yellow. Or when we make a color to blink above
already used leds.

As sxmo now rely on an idle daemon that slowly move it to crust, having
long running leds isnt that mandatory now.

It will also make it more easy for other script to notice the user. By
example, we dont have that much merged leds now.

To avoid this, we would rely more on blinkind leds:

Move to unlock: blinking yellow
Move to lock: blinking blue
Move to off: blinking purple (blink periodically purple while in off)
Move to crust: blinking red

Additionnaly, I added a  icon in the status bar to make it more
explicit if the phone stay locked for a while

- Drop rtcwake that conflict with blinking led and are pretty useless

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:30:44 +01:00