mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2025-12-20 04:20:04 +01:00
rules: add battery charge limit udev and hwdb files
Set per battery-specific start/stop charge limits in udev as environment variable with the option to allow a user to override the default 60% start and 80% stop charge limit. Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
parent
669a1c2a27
commit
16277c88c4
3 changed files with 39 additions and 0 deletions
30
rules/60-upower-battery.hwdb
Normal file
30
rules/60-upower-battery.hwdb
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# This file is part of upower.
|
||||
#
|
||||
# The lookup keys are composed in:
|
||||
# 60-upower-battery.rules
|
||||
#
|
||||
# Match string format:
|
||||
# battery:<kernel>:<model_name>:dmi:<dmi pattern>
|
||||
#
|
||||
# The kernel is the name of battery in /sys/class/power_supply for
|
||||
# differentiating between multiple batteries.
|
||||
#
|
||||
# The model_name is battery model name in for example
|
||||
# /sys/class/power_supply/BAT0/model_name.
|
||||
#
|
||||
# The full DMI string of the running machine can be read from
|
||||
# /sys/class/dmi/id/modalias
|
||||
# That requires a kernel built with CONFIG_DMIID set, which is common.
|
||||
# The full DMI string is not needed here and the meaning of individual parts
|
||||
# can be seen in the source of the DMIID kernel module
|
||||
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/firmware/dmi-id.c
|
||||
#
|
||||
# To add local overrides, create a new file
|
||||
# /etc/udev/hwdb.d/61-battery-local.hwdb
|
||||
# and add your rules there. To load the new rules execute (as root):
|
||||
# systemd-hwdb update
|
||||
# udevadm trigger -v -p /sys/class/power_supply/BAT
|
||||
# where BAT is the battery in question.
|
||||
|
||||
battery:*:*:dmi:*
|
||||
CHARGE_LIMIT=60,80
|
||||
7
rules/60-upower-battery.rules
Normal file
7
rules/60-upower-battery.rules
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
ACTION=="remove", GOTO="battery_end"
|
||||
|
||||
SUBSYSTEM=="power_supply",ATTR{charge_control_start_threshold}!="" \
|
||||
IMPORT{builtin}="hwdb 'battery:$kernel:$attr{model_name}:$attr{[dmi/id]modalias}'", \
|
||||
GOTO="battery_end"
|
||||
|
||||
LABEL="battery_end"
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
rules = [
|
||||
'60-upower-battery.rules',
|
||||
'95-upower-wup.rules',
|
||||
'95-upower-hid.rules',
|
||||
]
|
||||
|
||||
hwdb = [
|
||||
'95-upower-hid.hwdb',
|
||||
'60-upower-battery.hwdb',
|
||||
]
|
||||
|
||||
if os_backend == 'linux'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue