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.

2 Likes

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.

Hi Rex, first I want to thank you for Retropie and Bookworm images, those made my day when I found them :slight_smile: . I followed your advice and tried the command above. It seams that no matter values (I tried to use higher ones 2500000/2400000) I’m getting the same readings and the charging rate is very slow. I would appreciate any tip/help how to troubleshoot the charing problem. Thank you in advance.
Nik

POWER_SUPPLY_NAME-axp20x-battery
POWER_SUPPLY_TYPE-Battery
POWER_SUPPLY_PRESENT=1
FOWER_SUPPLY_ONLINE=1
POWER_SUPPLY_STATUS-Discharging
POWER_SUPPLY_VOLTAGE_ NOW=3844000
POWER_SUPPLY_CURRENT_NOW=-581000
POWER SUPPLY_CONSTANT_CHARGE_CURRENT=2100000
POWER_ SUPPLY_CONSTANT_ CHARGE_CURRENT_MAX=2100000
POWER_SUPPLY HEALTH=Good
POWER SUFFIX_VOLTAGE MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE MIN_DESIGN=3300000
FONERSUPPLY-CAPACITY=75
POWER_SUPPLY_ENERGY_FULL=24790000
POWER_SUPPLY_ENERGY_NOW=18592500
POWER SUPPLY_ENERGY_FULL_DESIGN=24790000
POWER_SUPPLY_CALIBRATE=0
POWER_SUPPLY_POWER_NOW=0
POWER_SUPPLY_TECHNOLOGY=L1-1on
POWER_SUPPLY_CHARGE_FULL_DESIGN=6700000

All of my images are set to the max of what the charge controller will do. If you’re experiencing slow charging i’d look at what your charger is rated for. I’d suggest a charger rated for 5V 3A minimum. When powered off the uConsole will charge at the charge controllers default speed.

1 Like

Thank you for explaining, I tried different chargers that I have and still no success. This is all new for me, I didn’t even use Linux before, so I really appreciate the help. I ordered Anker 20 W USB C Charger to try.

This are the stats that I’m getting now:

Batteries 2x Nitecore Li-Ion Akku 18650 3400mAh NL1834

native-path: axp20x-battery
power supply: yes
updated: Sat 21 Sep 2024 06:06:49 PM CEST (19 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: charging
warning-level: none
energy: 10.9076 Wh
energy-empty: 0 Wh
energy-full: 24.79 Wh
energy-full-design: 24.79 Wh
energy-rate: 3.03697 W
voltage: 3.949 V
charge-cycles: N/A
time to full: 4.6 hours
percentage: 44%
capacity: 100%
technology: lithium-ion
icon-name: ‘battery-good-charging-symbolic’

It took 2,5 hours to charge to 44%

it takes a while to charge, especially if you’re using while it’s charging.