gnome-clocks waking the phone via a waking daemon (POC)
#1
Hi,
I've heard that gnome is working on letting gnome-clocks wake up the phone but didn't find anything in that regard.

So i experimented a little bit myself and got it to work with a little dirty hack. I don't really know a lot about the gnome ecosystem, vala, dbus, flatpack etc. so it really is a mess  Big Grin but kinda working.

I first tried to write directly to /sys/class/rtc/rtc0/wakealarm from gnome-clocks when an alarm is changed but it outright refused to. Even with chmod-ing that file. I don't really know why but my guess it's b/c of some flatpack specific stuff.

So i wrote a small external program "waked" which let's other programs register alarms via dbus to wake up the system. It's just a little experiment and still relies on /sys/class/rtc/rtc0/wakealarm being chmodded but better then nothing. Running waked as root didn't work because then the dbus sessions didn't play nicely.

Then i slapped some spaghetti to gnome-clocks to register it's alarms in waked. Really messy, just a poc.

You can find the result here: https://gitlab.com/seath1
waked needs sdbus-cpp to build

What do you think, could that be a step in the right direction? I'm a bit surprised I couldn't find something existing to schedule rtc wakeups other than systemd timers which afaik doesn't let users add their own timers.
  Reply
#2
Cool stuff, thanks for sharing. Have you seen the proof-of-concept alarm app by Kai Luke that also saves the wake time into rtc?

(02-27-2021, 09:49 AM)seath Wrote: I've heard that gnome is working on letting gnome-clocks wake up the phone but didn't find anything in that regard.

Here's the relevant bug report if you wanna submit your patches.
  Reply
#3
Yes I saw the his app albeit just after I tried this approach.

Looks like he is using the systemd timer approach. Seems like hes escalating privileges with a helper utility.
In contrast I guess using a daemon could have the benefit of letting multiple programs schedule wake-ups in an unified manner.
For example the alarms from the clock and events from the calendar etc. maybe even build a system for permissions, which apps are allowed to wake up the phone in the long run.

For now I changed it to run as a service via systemd and use the system bus in dbus. I added PKGBUILDs to the repo to ease up the installation if someone wants to try.
The service needs to be started/enabled via

Code:
systemctl enable waked
# then reboot or
systemctl start waked
But be warned it's very janky.
1. That gnome-clocks version doesn't remove registered wake-ups when you delete or deactivate an alarm
2. waked atm only reschedules the next wake-up if called from outside. (Which that gnome-clocks version does minutely if running and at least one active alarm present when an alarm fires or gets changed otherwise)
3. waked forgets all registered alarm on reboot or if the service gets restarted one way or another
4. don't know if it plays nicely if systemd timers (or other stuff managing rtc wake-ups) are present.

Edit1: updated gnome-clocks-waked
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How-To: Remote Control Your Phone from Desktop via VNC biketool 2 535 10-12-2024, 11:47 AM
Last Post: biketool
  Article: NuttX RTOS for PinePhone: Feature Phone UI in LVGL, Zig and WebAssembly lupyuen 64 26,962 09-09-2023, 09:49 AM
Last Post: WhiteHexagon
  Article: NuttX RTOS for PinePhone: Phone Calls and Text Messages lupyuen 2 1,990 05-03-2023, 05:03 PM
Last Post: lupyuen
  [Stupid Question] Where is the phone camera software?! newusername 5 3,877 10-10-2022, 03:58 AM
Last Post: newusername
Question New user/phone here - initial update issues sexywheat 2 2,230 06-29-2022, 04:27 PM
Last Post: sexywheat
  Which apps can I run on this phone? poppyhodler 2 2,970 06-07-2022, 12:18 PM
Last Post: jenniferjohn12
  Phone Operation which SW Realease (mute funtion)? scrwbigtek 0 1,062 05-25-2022, 07:35 AM
Last Post: scrwbigtek
Photo GNOME Display Orientation Unregistered Guest 0 958 05-20-2022, 06:09 AM
Last Post: Unregistered Guest
  Keyboard Case Power Management Daemon estokes 2 2,616 04-16-2022, 04:15 PM
Last Post: estokes
  Jami on the Pine phone ? bcnaz 7 6,767 04-03-2022, 12:10 PM
Last Post: Fish

Forum Jump:


Users browsing this thread: 1 Guest(s)