rules: 60-upower-battery: Fix for Asus battery charge threshold detection

At boot, the Asus battery driver returns -ENODATA [1] to avoid resetting
charge threshold settings. This behavior prevents UPower's udev rules
from detecting the charge threshold feature. This issue can be resolved
by testing for the attribute's existence when matching udev rules, rather
than performing a read operation at boot.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers?id=186bf90

Resolves: #347
Signed-off-by: Kate Hsuan <hpa@redhat.com>
This commit is contained in:
Kate Hsuan 2026-07-02 14:00:55 +08:00
commit 83f86c75d2

View file

@ -1,10 +1,10 @@
ACTION=="remove", GOTO="battery_end"
SUBSYSTEM=="power_supply", ATTR{charge_control_start_threshold}!="", \
SUBSYSTEM=="power_supply", TEST=="charge_control_start_threshold", \
IMPORT{builtin}="hwdb 'battery:$kernel:$attr{model_name}:$attr{[dmi/id]modalias}'", \
GOTO="battery_end"
SUBSYSTEM=="power_supply", ATTR{charge_control_end_threshold}!="", \
SUBSYSTEM=="power_supply", TEST=="charge_control_end_threshold", \
IMPORT{builtin}="hwdb 'battery:$kernel:$attr{model_name}:$attr{[dmi/id]modalias}'", \
GOTO="battery_end"