pplockd: Simple power management/CRUST daemon for X11 GUIs on PinePhone
So now that I've gotten it working how I want, I'll post the daemon I'm using on Fedora XFCE to handle power management, CRUST, etc.
It's written with the following assumptions:
  • You're on an Xorg desktop-oriented GUI on a real Linux distro
  • You don't wanna have to set up essential apps to use wakelocks and all that stuff
  • You can run something as root
  • You have the Xorg utilities xset, xinput, and xrandr installed
  • You have set your DE's power manager to ignore the power button
  • You have Python 3.6 or above. Fedora 32 etc use 3.8 by default.
You can run it from its git repository directory, just ./pplockd, or ./pplockd --nodaemon to keep running in foreground.

You can also copy 'components' to /usr/local/share/pplockd/components, and PPConfig.py to /etc/pplockd/PPConfig.py.

You will need to edit the default user in PPConfig.py, the config file, which also handles the triggers for different buttons.

By default, the buttons are mapped as follows:
  • Hit up then down volume keys to rotate screen from portrait to landscape, including touchscreen input (in sequence, since hardware doesn't allow vol up+down at same time)
  • Hit power button to 'soft lock', leaving the phone running, e.g. if you're playing music but keep the phone in your pocket. This shuts off all but 1 core and scales the remaining one to 600Mhz, in addition to shutting off the screen and touch input. It sets monitor inactivity to 5 seconds (changeable in PPConfig.py) to prevent battery wasteage, since it seems the modem is 'chatty', sending random events quite often, which light up the screen.
  • Hit vol down + power (at same time) to 'hard lock', this does everything soft lock does, but puts the phone to sleep as well. It should wake on incoming calls and texts if you've configured your modem properly. You are given (changeable in PPConfig.py) 30 seconds to hit the power button, then the phone sleeps again. 
  • In any case, you can always wake the phone fully using the power button.
Here's the repo: https://github.com/Subsentient/pplockd
So as a minor update, right now the LED indicators are used to show the sleep state. It flashes green every 3 seconds for a soft lock, the LED is off for a hard lock, and when temporarily woken by a modem event from a hard lock, that's indicated by the LED being solid blue, until it resumes a sleep state. Just use the latest git/master, I haven't dealt with versioning yet.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Arch Linux ARM on PinePhone (2020/07/15) Danct12 10 590 2 hours ago
Last Post: hiimtye
Rainbow Sxmo - Simple X Mobile Released for the Pinephone (new minimalistic UI & image) mil 80 6,277 07-13-2020, 07:30 PM
Last Post: mil
  openSUSE en Pinephone Alefnode 18 1,990 07-12-2020, 05:37 AM
Last Post: Jojonintendo
  PureOS on Pinephone dukla2000 75 8,556 07-11-2020, 04:24 PM
Last Post: clover
  AVMultiphone on Pinephone Juergen 6 340 07-09-2020, 08:48 AM
Last Post: Juergen
  After installing CRUST, what does a distro need to do to get wake on modem working? Subsentient 4 347 07-06-2020, 04:32 AM
Last Post: Alefnode
  Fedora + Phosh for PinePhone njha 23 4,816 07-03-2020, 08:02 AM
Last Post: moruno
  Arch Linux on PinePhone Rocky-IV 3 2,071 06-27-2020, 08:37 PM
Last Post: d45050
  Common Lisp on the PinePhone duncan_bayne 1 275 06-24-2020, 04:11 PM
Last Post: fouric
  Is there a sound card input on the Pinephone which can be used by Python software? Peter Gamma 5 232 06-24-2020, 06:08 AM
Last Post: wibble

Forum Jump:

Users browsing this thread: 1 Guest(s)