system76 / ec

System76 Open Source Embedded Controller
GNU General Public License v3.0
318 stars 72 forks source link

sysfs current_now doesn't report negative values during discharge #468

Open jacobgkau opened 2 months ago

jacobgkau commented 2 months ago

Kernel documentation states regarding the /sys/class/power_supply/<supply_name>/current_now value:

Negative values are used for discharging batteries, positive values for charging batteries and for USB IBUS current.

However, we currently report positive (or unsigned) values for a battery whether we're charging or discharging.

@crawfxrd says it's a u16 in the code.