07-26-2023, 06:31 AM
(This post was last modified: 07-26-2023, 07:03 AM by JudgeFudge.
Edit Reason: Syntax
)
Thanks for the feedback!
I have tested this part thoroughly as well, and while there would be certainly a difference in turning the keyboard off, I could not measure one relevant enough (no power meter, simply battery consumption/X hours).
However, if this is a problem for you, I stumbled upon a solution you may find handy. You can turn the battery charging of the keyboard off programmatically, and turn it on again. Also, you can run scripts triggered right before and after suspend. This means that you would not have to do it manually.
For this to work, you will first need to compile the pinephone keyboard software:
sudo apt install -y php gcc make git i2c-tools
sudo systemctl disable apache2 && sudo systemctl stop apache2
git clone https://megous.com/git/pinephone-keyboard
cd pinephone-keyboard
make
sudo modprobe i2c-dev
echo i2c-dev | sudo tee -a /etc/modules
sudo cp build/ppkb-charger-ctl /usr/local/bin/
sudo /usr/local/bin/ppkb-charger-ctl info
After that, you can write a script that triggers this ppkb-charger-ctl power-off or similar (as root user, try around the commands)
by placing a bashscript in /usr/lib/systemd/system-sleep/ with something like
#!/bin/sh
if [ "${1}" == "pre" ]; then
# Do the thing you want before suspend here, e.g.:
/usr/local/bin/ppkb-charger-ctl power-off
elif [ "${1}" == "post" ]; then
# Do the thing you want after resume here, e.g.:
/usr/local/bin/ppkb-charger-ctl power-on
fi
The sleep/resume script is entirely untested, but I managed to control the keyboard with the commands from ppkb-charger-ctl.
Maybe that helps, you can ask if that interests you and you need more info
I have tested this part thoroughly as well, and while there would be certainly a difference in turning the keyboard off, I could not measure one relevant enough (no power meter, simply battery consumption/X hours).
However, if this is a problem for you, I stumbled upon a solution you may find handy. You can turn the battery charging of the keyboard off programmatically, and turn it on again. Also, you can run scripts triggered right before and after suspend. This means that you would not have to do it manually.
For this to work, you will first need to compile the pinephone keyboard software:
sudo apt install -y php gcc make git i2c-tools
sudo systemctl disable apache2 && sudo systemctl stop apache2
git clone https://megous.com/git/pinephone-keyboard
cd pinephone-keyboard
make
sudo modprobe i2c-dev
echo i2c-dev | sudo tee -a /etc/modules
sudo cp build/ppkb-charger-ctl /usr/local/bin/
sudo /usr/local/bin/ppkb-charger-ctl info
After that, you can write a script that triggers this ppkb-charger-ctl power-off or similar (as root user, try around the commands)
by placing a bashscript in /usr/lib/systemd/system-sleep/ with something like
#!/bin/sh
if [ "${1}" == "pre" ]; then
# Do the thing you want before suspend here, e.g.:
/usr/local/bin/ppkb-charger-ctl power-off
elif [ "${1}" == "post" ]; then
# Do the thing you want after resume here, e.g.:
/usr/local/bin/ppkb-charger-ctl power-on
fi
The sleep/resume script is entirely untested, but I managed to control the keyboard with the commands from ppkb-charger-ctl.
Maybe that helps, you can ask if that interests you and you need more info