Can't override battery charge speed anymore

This is an old problem that was never properly fixed, as outlined here: uConsole: How Does Charging Work?
and here: Extremely Slow Battery Charging

I reinstalled my uConsole’s os, and somehow, I can’t do the old udev trick anymore.
I created a file /etc/udev/rules.d/99-charging.rules with these contents:

KERNEL=="axp20x-battery", SUBSYSTEM=="power_supply", ATTR{constant_charge_current_max}="1700000", ATTR{constant_charge_current}="1700000"

but even after a udev reload and reboot, nothing is happening.

Running sudo udevadm test /sys/class/power_supply/axp20x-battery tells me that udev seems to be confused about the rules file:

axp20x-battery: /etc/udev/rules.d/99-charging.rules:1 Failed to write ATTR{/sys/devices/platform/soc/fe205000.i2c/i2c-0/0-0034/axp20x-battery-power-supply/power_supply/axp20x-battery/constant_charge_current}, ignoring: Invalid argument

How do I fix this? This used to work in the past, but I have no idea what might’ve changed to break it.

This is the command I’ve been issuing on a fresh SD card.

echo ‘KERNEL==“axp20x-battery”, ATTR{constant_charge_current_max}=“2200000”, ATTR{constant_charge_current}=“2000000”’ | sudo tee /etc/udev/rules.d/99-uconsole-charging.rules

Change the values to your liking, let me know if it worked for you.


That did it, thanks. Turns out the driver(?) will reject changes with an error if the new value is below some arbitrary threshold. Setting them to your values works though.

FWIW I’ve been trying to understand the driver’s code for an hour (linux/drivers/power/supply/axp20x_battery.c at master · torvalds/linux · GitHub) but I haven’t been able to determine what that threshold is.