device-pine64-pinephone: shutdown on critical battery (MR 2193)
The PMIC AXP803 sends an interrupt to the A64 CPU when the battery is critical low. This wakes up the phone at ~10% battery level, but UPower wasn't configured to add upon this interrupt as the action level was way lower. Therefore, the PMIC performed a hard shutdown when the battery level dropped further, which may cause data loss.
This commit is contained in:
parent
4de4052422
commit
cfb5d41bdf
2 changed files with 108 additions and 2 deletions
|
@ -4,8 +4,8 @@
|
|||
# Co-Maintainer: Bart Ribbers <bribbers@disroot.org>
|
||||
# Co-Maintainer: Clayton Craft <clayton@craftyguy.net>
|
||||
pkgname=device-pine64-pinephone
|
||||
pkgver=0.27
|
||||
pkgrel=1
|
||||
pkgver=0.28
|
||||
pkgrel=0
|
||||
pkgdesc="PINE64 PinePhone"
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
|
@ -16,6 +16,7 @@ subpackages="
|
|||
$pkgname-phosh
|
||||
$pkgname-shelli
|
||||
$pkgname-plasma-mobile:plasma_mobile
|
||||
$pkgname-upower
|
||||
"
|
||||
depends="
|
||||
alsa-ucm-conf
|
||||
|
@ -55,6 +56,7 @@ source="
|
|||
ucm/HiFi.conf
|
||||
ucm/PinePhone.conf
|
||||
ucm/VoiceCall.conf
|
||||
UPower.conf
|
||||
"
|
||||
# workaround to purge the -elogind subpackage that was previously
|
||||
# created/installed
|
||||
|
@ -155,6 +157,15 @@ plasma_mobile() {
|
|||
install -Dm644 "$srcdir"/kirigami-lowpower.sh "$subpkgdir"/etc/profile.d/kirigami-lowpower.sh
|
||||
}
|
||||
|
||||
upower() {
|
||||
install_if="$pkgname=$pkgver-r$pkgrel upower"
|
||||
mkdir "$subpkgdir"
|
||||
|
||||
# Shutdown when PMIC reports critical battery level
|
||||
install -Dm644 "$srcdir"/UPower.conf -t \
|
||||
"$subpkgdir"/etc/UPower/UPower.conf
|
||||
}
|
||||
|
||||
shelli() {
|
||||
install_if="$pkgname=$pkgver-r$pkgrel shelli"
|
||||
|
||||
|
@ -184,4 +195,5 @@ f4b5509fd6a8b23f3667f5e7262b3a19c607a37cb9eaf7d0e93eb826d45c26ec12df4810879bacb8
|
|||
aef9f00f1d327b11640c4dbcb7b6ad5b0bac3118e262af5d7d6a37d87757559856438c0adea834f03752725876c3f857ed903cdfaaf678459bbcd7633d523ded HiFi.conf
|
||||
e852b48a687f9b2a0eca444aa3d00a1818aead9f5e5d28e070b51c9d6f8ec648e66f1d88e2bfa94d74533f9ffb9aacc1703da2a06693f85fa04ff97fd7528012 PinePhone.conf
|
||||
6e226e8dc39a438629f443a33e1ba7ea5f7f1a08b98ec58b2bf97036e549d3ce9898de708020a632f4fd2f9d6540a621331e4d2c406c1e729d073113aff55ec3 VoiceCall.conf
|
||||
ed0e03f7e1c0348c06be9a7922414469245604ce813bbf0c8910ef211cb993bbb0d0d4615c9c961d50712415f85d6b73e0cf02780ac784666aac56e4889341e4 UPower.conf
|
||||
"
|
||||
|
|
94
device/main/device-pine64-pinephone/UPower.conf
Normal file
94
device/main/device-pine64-pinephone/UPower.conf
Normal file
|
@ -0,0 +1,94 @@
|
|||
# Only the system vendor should modify this file, ordinary users
|
||||
# should not have to change anything.
|
||||
|
||||
[UPower]
|
||||
|
||||
# Enable the Watts Up Pro device.
|
||||
#
|
||||
# The Watts Up Pro contains a generic FTDI USB device without a specific
|
||||
# vendor and product ID. When we probe for WUP devices, we can cause
|
||||
# the user to get a perplexing "Device or resource busy" error when
|
||||
# attempting to use their non-WUP device.
|
||||
#
|
||||
# The generic FTDI device is known to also be used on:
|
||||
#
|
||||
# - Sparkfun FT232 breakout board
|
||||
# - Parallax Propeller
|
||||
#
|
||||
# default=false
|
||||
EnableWattsUpPro=false
|
||||
|
||||
# Don't poll the kernel for battery level changes.
|
||||
#
|
||||
# Some hardware will send us battery level changes through
|
||||
# events, rather than us having to poll for it. This option
|
||||
# allows disabling polling for hardware that sends out events.
|
||||
#
|
||||
# default=false
|
||||
NoPollBatteries=false
|
||||
|
||||
# Do we ignore the lid state
|
||||
#
|
||||
# Some laptops are broken. The lid state is either inverted, or stuck
|
||||
# on or off. We can't do much to fix these problems, but this is a way
|
||||
# for users to make the laptop panel vanish, a state that might be used
|
||||
# by a couple of user-space daemons. On Linux systems, see also
|
||||
# logind.conf(5).
|
||||
#
|
||||
# default=false
|
||||
IgnoreLid=false
|
||||
|
||||
# Policy for warnings and action based on battery levels
|
||||
#
|
||||
# Whether battery percentage based policy should be used. The default
|
||||
# is to use the time left, change to true to use the percentage, which
|
||||
# should work around broken firmwares. It is also more reliable than
|
||||
# the time left (frantically saving all your files is going to use more
|
||||
# battery than letting it rest for example).
|
||||
# default=true
|
||||
UsePercentageForPolicy=true
|
||||
|
||||
# When UsePercentageForPolicy is true, the levels at which UPower will
|
||||
# consider the battery low, critical, or take action for the critical
|
||||
# battery level.
|
||||
#
|
||||
# This will also be used for batteries which don't have time information
|
||||
# such as that of peripherals.
|
||||
#
|
||||
# If any value is invalid, or not in descending order, the defaults
|
||||
# will be used.
|
||||
#
|
||||
# Defaults:
|
||||
# PercentageLow=10
|
||||
# PercentageCritical=3
|
||||
# PercentageAction=2
|
||||
PercentageLow=20
|
||||
PercentageCritical=17
|
||||
PercentageAction=15
|
||||
|
||||
# When UsePercentageForPolicy is false, the time remaining at which UPower
|
||||
# will consider the battery low, critical, or take action for the critical
|
||||
# battery level.
|
||||
#
|
||||
# If any value is invalid, or not in descending order, the defaults
|
||||
# will be used.
|
||||
#
|
||||
# Defaults:
|
||||
# TimeLow=1200
|
||||
# TimeCritical=300
|
||||
# TimeAction=120
|
||||
TimeLow=1200
|
||||
TimeCritical=300
|
||||
TimeAction=120
|
||||
|
||||
# The action to take when "TimeAction" or "PercentageAction" above has been
|
||||
# reached for the batteries (UPS or laptop batteries) supplying the computer
|
||||
#
|
||||
# Possible values are:
|
||||
# PowerOff
|
||||
# Hibernate
|
||||
# HybridSleep
|
||||
#
|
||||
# If HybridSleep isn't available, Hibernate will be used
|
||||
# If Hibernate isn't available, PowerOff will be used
|
||||
CriticalPowerAction=PowerOff
|
Loading…
Reference in a new issue