

Piper is less than 2MB, and allows reconfiguring Logitech mouse buttons. It’s available in Debian and Ubuntu package managers.
Screenshot:
I had to use Piper to get exotic features like having mouse 6, 7, 8 buttons function as mouse 6, 7, 8, rather than the default of alt-tab and ctrl-v.
It’s hard because it’s not a perfect linear relationship between battery voltage and battery percentage. When the battery is 80% full, the voltage hardly changes at all as it drains. But it can change significantly with unrelated factors, like age and temperature. So they have to use the integral of current consumption to calculate the battery level. There are other tricks, too, like using temperature to check battery percentage (when the battery is charging, it heats up if it’s nearly full), and some lithium ion batteries have a third wire for measuring the temperature.