power_supply_vbat2ri(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… power_supply_vbat2ri β€” the kernel API manual, bestie edition ✨

Okay so picture this: you're deep in the power_supply subsystem (iconic of you, honestly), and you need to know how much resistance the battery is giving you at its current voltage. That's literally this function. It's from the Kernel API Manual, and it's here to slay. 🫢


🌸 NAME 🌸

power_supply_vbat2ri β€” find the battery internal resistance from the battery voltage. That's the whole gig. No cap. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

int power_supply_vbat2ri (struct power_supply_battery_info *info , int
vbat_uv , bool charging );

Like I said. Three args, one int coming back at you. Clean. ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • info β€” the battery information container. It's giving "everything you ever wanted to know about this battery." πŸ‘‘
  • vbat_uv β€” the battery voltage, in microvolt. Yes, *micro*volt. Little tiny volts. 🐜
  • charging β€” are we charging (true) or not (false)? Binary queen behavior, honestly. ⚑

🌈 DESCRIPTION 🌈

So here's the vibe: this helper function is used to look up battery internal resistance according to current battery voltage. That's it, that's the function. πŸ’…

And the cute part β€” depending on whether the battery is currently charging or not, different resistance will be returned. So that charging bool is not just decoration, bestie, it actually matters. 🧚

Returns the internal resistance in microohm or a negative error code. So if you get a negative number back, don't panic, that's not a resistance, that's the universe telling you something went wrong. 😭

Heads up: microvolt in, microohm out. Keep your units straight or the vibe check will fail you. πŸ’€

⭐ SEE ALSO ⭐

Kernel file ./drivers/power/supply/power_supply_core.c β€” literally where the magic lives, go read it.

And the whole friend group:

All of them. Every single one. Go follow them, they're all baddies. πŸ‘‘


That's the whole page, bestie! This one's filed under ./drivers/power/supply, dated October 2026, and it's part of the Kernel API Manual. Now go forth and compute some resistances. Slay. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from