batteryIcon.py read SOC and AC status from /sys/class/power_supply, which only exists when the oneUpPower kernel module is loaded. When the module fails to load (e.g. a DKMS vermagic mismatch after a kernel update), the icon showed only "N/A". Read the battery IC directly over I2C (bus 1, addr 0x64, regs 0x04 and 0x0E -- the same registers oneUpPower.c uses) via smbus2. force=True bypasses the I2C_SLAVE busy check so the read still works whether or not the kernel module has claimed the address. The icon now works for an ordinary user in the i2c group, with no sudo and no kernel module. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5.2 KiB
Executable File
5.2 KiB
Executable File