Page 1 of 1

battery api

Posted: 11 Jul 2022, 12:39
by brutus
Hello,

we have a web application that accesses the browser's battery API. From Mozilla there is information (https://developer.mozilla.org/en-US/doc ... Status_API) for this, strangely Firefox does not support the battery indicator. So I installed Chrome which supports this.
But chrome browser always shows 100% battery level.
Can I do something on the system side so that the correct battery level is displayed?
With

Code: Select all

cat /sys/class/power_supply/axp288_fuel_gauge/capacity
I can display the correct battery level on the command line.

BR,
Michael

battery api

Posted: 11 Jul 2022, 14:50
by fanthom
Michael,

Please check if it works under Ubuntu.
If not then query Chrome devs why it does not work (under Ubuntu).

Thanks

battery api

Posted: 12 Jul 2022, 06:24
by brutus
There is evidence that the battery api interacts with upower. At least regarding firefox beta.
https://hacks.mozilla.org/2012/02/using ... of-webapi/
Linux (for those distros that have UPower installed – bundled with most nowadays)

Is upower installed?

battery api

Posted: 12 Jul 2022, 07:49
by fanthom
Michael,

Upower is not available by default:
https://porteus-kiosk.org/packages.html

it could be added through a customized build.

Please check under Ubuntu if it really works. Some other components may be also missing in our system.

Thanks

battery api

Posted: 12 Jul 2022, 13:06
by brutus
I tried with MX Linux (debian based). Ubuntu was a total shit show, crashed all the time. Wasn't able to install it.

And it works, chrome showed the correct percentage.