68 Commits

Author SHA1 Message Date
ArenM
3ab2b5480f Read wakeup_count instead of using sxmo_wakeafter
The approach sxmo_wakeafter uses is flawed because the kernel isn't
obligated to pass control to it after suspend. I'm pretty sure it
normally gets called when the kernel updates the system clock.

Since we're waiting for some time after every suspend we're not actually
using opportunistic suspend. It's much simpler to read wakeup_count to
ask the kernel to wait until there's no active locks.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-02-24 09:42:44 +01: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
ArenM
4201985e17 Support using a physical keyboard for dtmf tones
Opening a terminal window to read dtmf tones makes it possible to use a
physical keyboard to enter them. Not needing to read keys from
{wvkbd,svkbd} -o should make things generally more robust too.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-10-31 10:26:24 +01:00
Anjandev Momi
be5aeafef1 sxmo_vibrate.c: use SXMO_VIBRATE_DEV envvariable 2022-10-16 20:40:02 -07:00
ArenM
fba369252f avoid drift in clocks
This adds a sleep program that wakes up when the time (in seconds) is
divisible by a specific number, so for example passing 60 to it will
make it exit at the beginning of each minute.

This program is also able to exit when the system exits suspend (when
the kernel syncs the clock), which means we don't need to signal the
clocks anymore.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-07-01 12:06:27 +02:00
Nihal Jere
55fdbd5bf1 sxmo_splitchar: simplify
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-04-03 12:16:51 +02:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
704f637236 Rework the modem call menu
- Simplify the menus code

We use new patterns to make it simple to read the code

- Use callaudiod

This script isnt pulseaudio/pipewire perfectly compatible. It doesnt
create nodes that are natives and managed by those audio daemons. But it
connect to thoses to know the audio setup and offer a simple cli to
manage basic commands as speaker toggle by example. It also handle ootb
the connected jack audio devices which make our life way simpler.

This solution isnt perfect but it is better than the megi script we use
atm that is pinephone specific.
2022-02-09 19:11:23 +01:00
Nihal Jere
c309751b33 rename sxmo_vibratepine to sxmo_vibrate
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:45 +01:00
Nihal Jere
faf2030c7e sxmo_vibratepine: print errors to stderr
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:33 +01:00
Nihal Jere
6da8b1bbc1 sxmo_vibratepine: use nanosleep instead of usleep
usleep is only guaranteed to accept values up to 1,000,000
microseconds, which is 1 second. nanosleep does not have this
limitation.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:33 +01:00
Nihal Jere
f95137e64f sxmo_vibratepine: check that arguments are valid
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:32 +01:00
Nihal Jere
f67f56c52a sxmo_vibratepine: remove unused variable
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:32 +01:00
Stacy Harper
cdac52dc7c Use virtual keyboard as dtmf menu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-29 11:03:03 +01:00
Martin Vahlensieck
8cb2cd43ec Replace tabs with spaces to line up usage
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-27 11:11:36 +02:00
Nihal Jere
ce3f2ea319 replace setpineled C program with a shell script
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-11 22:27:28 +02:00
Anjandev Momi
ccc6223c1b Revert "add a configurable daemon that warns on low battery"
This reverts commit c7e0e3b656.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-07-15 18:29:35 -04:00
noneofyourbusiness
c7e0e3b656 add a configurable daemon that warns on low battery
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-21 23:01:48 +02:00
Anjandev Momi
725d89d6d6 Rework the sxmo screenlock 2021-06-06 09:41:36 +02:00
Clayton Craft
d42c4f58d4 programs/sxmo_setpinebacklight: drop unused application
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-05-20 09:44:53 +02:00
Maarten van Gompel
d2d06ef65a Revert "Workaround for reliable incoming calls waking up from CRUST", no longer needed with eg25-manager and caused ModemManager restart issues
This reverts commit bcf4f5c249.
2021-04-05 12:01:32 +02:00
Jochen Sprickerhof
d70a4aed63 Use by-path for vibrator device
No need to search for correct device.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-03-05 12:34:39 -05:00
Maarten van Gompel
d71c11d993 Some improvements for the relock problem: Unable to open rtc device. But issue it not solved yet. #170 2021-02-20 13:42:58 +01:00
Maarten van Gompel
c1fe2df7d1 Added user access for missing wakeup sources 2021-02-05 22:59:07 +01:00
Maarten van Gompel
9d1527218a blank screen when locking #158 2021-02-01 18:32:28 +01:00
Maarten van Gompel
1608ab1ae4 increased verbosity in various scripts, and do not run xargs kill when argument is empty (cleaner and clearer stderr messages) 2021-01-30 21:41:08 +01:00
Maarten van Gompel
ca88d3029e Enable user access to pinephone hardware kernel interface through openrc script, remove setuid 0 requirement 2021-01-30 21:41:08 +01:00
Maarten van Gompel
00cf2ba3ec reduce wifi reconnection time after deep sleep #150 2021-01-30 21:40:56 +01:00
Maarten van Gompel
6750e3e47b fix for calling postwake script after wakeup #130 2020-12-09 18:30:44 +01:00
Daniele Rogora
bcf4f5c249 Workaround for reliable incoming calls waking up from CRUST
Replaced system() call with writefile()

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-12-05 11:58:31 +01:00
Maarten van Gompel
7fb7cd70f3 various indentation fixes (spaces to tabs and stripping trailing whitespace) 2020-11-20 18:10:17 +01:00
Miles Alan
8abe870012 Make suspendtimeout for screenlock cutomizable via SXMO_SUSPENDTIMEOUTS
This way if someone wants a longer or shorter timeout that possible
by setting the env var SXMO_SUSPENDTIMEOUTS.

Also change the default to be 35s. This is roughly the duration of
ringing for an incoming phone call.
2020-11-20 17:27:37 +01:00
Anjandev Momi
a0c6e4c2e2 enable bluetooth and modem drivers during crust suspend
With the megi 5.9 kernel and other suspend-related merge requests in
postmarketos, disabling these drivers is no longer needed. All of this
should result in a more reliable suspending system.

Source: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/1651
Signed-off-by: Miles Alan <m@milesalan.com>
2020-11-07 08:28:27 -06:00
Miles Alan
acf21efba8 Fix wakeup from CRUST for incoming call for 5.9 kernel 2020-11-07 08:05:50 -06:00
Maarten van Gompel
6448587eb8 complete revision of gestures, using new edge system
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-10-31 13:53:46 +01:00
Maarten van Gompel
1b45e7743d added SXMO_LOCK_SCREEN_OFF and SXMO_LOCK_SUSPEND environment variables to set a target stage from the environment
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-10-31 12:16:06 +01:00
Maarten van Gompel
642bf1cc27 Implementing optional rtc wakeup at regular intervals, added presuspend, rtcwake and postwake scripts (with hooks)
(includes missing return 0 statement caught by Serge Hallyn)

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-10-31 12:13:22 +01:00
Anjandev Momi
55887d9afe update megiaudioroute.c for 5.9 kernel
When combined with Sam's audio patch, this fixes audio calls on 5.9
kernel.

Source: https://xnux.eu/devices/feature/audio-pp.html
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-10-28 23:57:33 -04:00
Serge E. Hallyn
5a4ce877df screenlock: set max field width for sprintf
Stop a compiler warning about overwriting the 100 char buffer with larger
string.

programs/sxmo_screenlock.c:61:3: note: ‘sprintf’ output between 39 and 294 bytes into a destination of size 100
2020-09-15 19:28:47 -05:00
Serge E. Hallyn
2cec0fc3be Enable irq wakeups
This is needed for crust to wake us up on an incoming call.

Thanks to smaeul in #crust for the tip.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2020-09-15 19:28:14 -05:00
Miles Alan
45c571727c Cleanup logic for notification LED setting; increase default call volume 2020-08-22 16:16:26 -05:00
Julian P Samaroo
a24d966b7e Fix = to == in screenlock 2020-07-30 18:39:14 -05:00
Maarten van Gompel
113f756eb1 Adding a wrapper around sxmo_screenlock, with lock/unlock hooks. Allow setting a target state for sxmo_screenlock, and cleanup on sigterm. Added lock/suspend options to the power menu.
Should be applied after my prior patches from today.
2020-07-26 10:31:57 -05:00
Miles Alan
f3275b7cd7 After exiting suspend blink LED while in temporary suspend pending state 2020-07-21 21:40:56 -05:00
Miles Alan
92e048a153 Screenlock: Recognize keyrelease rather than keydown to avoid inadvertent exits
E.g. so now you distinctively have to press down the powerbutton three times
rather than holding (which is easy to do inadvertently in pocket) to exit
screenlock.
2020-07-15 21:47:50 -05:00
Miles Alan
d713b19199 Use sxmo_statusbarupdate.sh script instead of direct calls duplicated logic 2020-07-12 11:38:31 -05:00
Miles Alan
10705f08cd Update statusbar on waking up from deep sleep so battery % & time accurate 2020-07-12 11:32:04 -05:00
Miles Alan
383c52380f 5s timeout for StateSuspendPending 2020-07-11 09:53:15 -05:00
Miles Alan
a35ca3f39f screenlock - Sort functions alphabetically; add declarations; and fix warnings 2020-07-09 21:17:11 -05:00
Miles Alan
b51644baca screenlock - Implement StateSuspendPending so exiting CRUST requires 3 clicks
If you don't triple click after exiting deep sleep after 10s, use select() with
timeout to kick back into deep sleep.
2020-07-09 20:51:50 -05:00