This feels like a stack exchange EE question, but it seems like it belongs here instead.
How is the charge of a notebook computer's battery reported to the operating system? Since all laptop batteries I've seen seem to be cross-platform, there must be some standard procedure to inform the kernel of the charge level.
The best I can think of is that some microcontroller has to maintain a serial connection and inform the OS of the battery's voltage, but I can't figure out how this applies to determining things like whether the AC is plugged in or how this information is reported to the OS.
This seems like such a basic problem, but Googling it just led me to consumers trying to increase their battery life.