pplockd: Simple power management/CRUST daemon for X11 GUIs on PinePhone
#1
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
  Reply
#2
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.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Slarm64 on PinePhone [Unofficial Slackware ARM - 64 bit] acid andy 11 2,726 06-15-2021, 09:50 PM
Last Post: teneighty
  PureOS on Pinephone dukla2000 85 52,818 06-11-2021, 06:19 AM
Last Post: Nooblife
  Amazfish on Pinephone pagesix1536 6 1,063 06-04-2021, 11:05 AM
Last Post: pagesix1536
Brick VR apps for the Pinephone (Google Cardboard) MirceaKitsune 0 147 05-30-2021, 10:45 AM
Last Post: MirceaKitsune
  pinephone oses and qemu emulation streak 0 199 05-20-2021, 07:00 AM
Last Post: streak
  Pine Phone Desktop Mode or "Standard" Gnome Desktop on PinePhone? 4920441 4 839 05-11-2021, 02:42 AM
Last Post: wizmart
  Fedora + Phosh for PinePhone njha 55 34,507 05-10-2021, 03:56 AM
Last Post: wizmart
  Adafruit Pyloton Open Source Bike computer on the PinePhone? Peter Gamma 0 377 04-02-2021, 06:37 PM
Last Post: Peter Gamma
  openSUSE for Pinephone Alefnode 68 32,086 03-21-2021, 11:43 AM
Last Post: andresbs
  freeglut3 on the PinePhone Samuel Venable 1 512 03-10-2021, 03:06 PM
Last Post: nas

Forum Jump:


Users browsing this thread: 1 Guest(s)