battery api

'User made' tutorials related to Porteus Kiosk edition.
Official kiosk documentation can be find here: http://porteus-kiosk.org/documentation.html
Forum rules
Porteus Kiosk section of the forum is unmaintained now. Its kept in a 'read only' mode for archival purposes.
Please use the kiosk contact page for directing your queries: https://porteus-kiosk.org/contact.html
brutus
Black ninja
Black ninja
Posts: 42
Joined: 20 May 2022, 06:10
Distribution: openSUSE

battery api

Post#1 by brutus » 11 Jul 2022, 12:39

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

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

battery api

Post#2 by fanthom » 11 Jul 2022, 14:50

Michael,

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

Thanks
Please add [Solved] to your thread title if the solution was found.

brutus
Black ninja
Black ninja
Posts: 42
Joined: 20 May 2022, 06:10
Distribution: openSUSE

battery api

Post#3 by brutus » 12 Jul 2022, 06:24

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?

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

battery api

Post#4 by fanthom » 12 Jul 2022, 07:49

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
Please add [Solved] to your thread title if the solution was found.

brutus
Black ninja
Black ninja
Posts: 42
Joined: 20 May 2022, 06:10
Distribution: openSUSE

battery api

Post#5 by brutus » 12 Jul 2022, 13:06

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.

Locked