Bug 415597 - "No Batteries Available" despite detecting a battery
Summary: "No Batteries Available" despite detecting a battery
Status: RESOLVED DUPLICATE of bug 350365
Alias: None
Product: plasmashell
Classification: Plasma
Component: Battery Monitor (show other bugs)
Version: 5.17.4
Platform: openSUSE Linux
: NOR major
Target Milestone: 1.0
Assignee: Kai Uwe Broulik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-27 01:55 UTC by Thiago Macieira
Modified: 2021-03-22 03:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2019-12-27 01:55:10 UTC
SUMMARY
The power/battery icon in the system tray is always displaying a full, black battery instead of a discharging one when I am on battery power. If I hover it, it says "No Batteries Available". If I click it, it shows the sliders for keyboard and screen brightness, but no information about the battery.

OBSERVED RESULT
Powerdevil does not display information about battery. However, it does detect when I am connected to the AC or not.

EXPECTED RESULT
Powerdevil tells me how long I have of battery life.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.17.4
Qt: 5.13.1
KDE Frameworks: 5.64.0

ADDITIONAL INFORMATION
When starting /usr/lib64/libexec/org_kde_powerdevil manually, it does say it detected a battery (same information is in the syslog):

$ /usr/lib64/libexec/org_kde_powerdevil
  Backend loaded, loading core
  Core loaded, initializing backend
  Using XRandR
  Screen brightness value:  131
  Screen brightness value max:  937
  current screen brightness value:  131
  Kbd backlight brightness value:  1
  current keyboard backlight brightness value:  1
  Backend ready, KDE Power Management system initialized
  Battery with UDI "/org/freedesktop/UPower/devices/battery_BAT0" was detected
  Session path: "/org/freedesktop/login1/session/_31"
  ACTIVE SESSION PATH: "/org/freedesktop/login1/session/_31"
  Current session is now active
  fd passing available: true
  systemd powersave events handling inhibited, descriptor: 18
  systemd support initialized
  Got a valid offer for  "DPMSControl"
  Core is ready, registering various services on the bus...
  Can't contact ck
  Currently using activity  "fbf8742b-b0e6-4bc4-a1e4-ee39e6482f5a"
  () ()
  () ()
  Loading profile for unplugged AC
  Activity is not forcing a profile
  Handle button events action could not check for screen configuration
  Profiles:  "Battery" ""
  Screen brightness value max:  937
  Can't contact ck
  set screen brightness value:  131
  Screen brightness value:  131

  Loading timeouts with  120000
  Can't contact ck
  Screen brightness value:  131

Solid also knows about this battery:

$ solid-hardware5 details /org/freedesktop/UPower/devices/battery_BAT0
udi = '/org/freedesktop/UPower/devices/battery_BAT0'
  parent = '/org/freedesktop/UPower'  (string)
  vendor = 'SMP'  (string)
  product = 'DELL JHXPY53'  (string)
  description = 'Lithium Polymer Battery'  (string)
  icon = 'battery'  (string)
  Battery.present = true  (bool)
  Battery.type = 'PrimaryBattery'  (0x3)  (enum)
  Battery.chargePercent = 55  (0x37)  (int)
  Battery.capacity = 77  (0x4d)  (int)
  Battery.rechargeable = true  (bool)
  Battery.powerSupply = true  (bool)
  Battery.chargeState = 'Discharging'  (0x2)  (enum)
  Battery.timeToEmpty = 6425  (0x1919)  (qlonglong)
  Battery.timeToFull = 0  (0x0)  (qlonglong)
  Battery.energy = 24.7304 (double)
  Battery.energyFull = 44.6652 (double)
  Battery.energyFullDesign = 57.532 (double)
  Battery.energyRate = 13.8548 (double)
  Battery.voltage = 7.393 (double)
  Battery.temperature = 0 (double)
  Battery.technology = 'LithiumPolymer'  (0x2)  (enum)
  Battery.recalled = false  (bool)
  Battery.recallVendor = ''  (string)
  Battery.recallUrl = ''  (string)
  Battery.serial = '2255'  (string)
  Battery.remainingTime = 6425  (0x1919)  (qlonglong)
Comment 1 Kai Uwe Broulik 2019-12-27 08:35:49 UTC
Does plasmaengineexplorer (part of plasma-sdk) also show it in power management engine? That's where data for the battery monitor comes from.
Comment 2 Thiago Macieira 2019-12-27 14:38:16 UTC
(In reply to Kai Uwe Broulik from comment #1)
> Does plasmaengineexplorer (part of plasma-sdk) also show it in power
> management engine? That's where data for the battery monitor comes from.

Yes, it does.

I have a Battery and a Battery0, with the latter showing the correct energy level and remaining time, as Solid shows.
Comment 3 Kai Uwe Broulik 2019-12-27 14:44:15 UTC
Odd. When you run the batterymonitor from terminal, does it print anything suspicious?

plasmoidviewer -a org.kde.plasma.battery
or
plasmawindowed org.kde.plasma.battery
Comment 4 Thiago Macieira 2019-12-27 14:52:56 UTC
Huh, the battery does show then.

After restarting Plasma, the battery does show now. I don't know why or when this started. Do you want me to investigate more or shall we close?
Comment 5 Kai Uwe Broulik 2019-12-27 15:03:41 UTC
Looks like a race or timing issue to me.. I've had similar reports in the past but I have never seen it happen on my system. :/

Maybe the DataModel (that turns Plasma DataEngine data into a QAIM) gets confused when the battery is added later, or something isn't initialized yet on login when Plasmashell starts initially but works later.

Did this happen after suspend or on fresh login?
Comment 6 Thiago Macieira 2019-12-27 16:38:07 UTC
(In reply to Kai Uwe Broulik from comment #5)
> Looks like a race or timing issue to me.. I've had similar reports in the
> past but I have never seen it happen on my system. :/
> 
> Maybe the DataModel (that turns Plasma DataEngine data into a QAIM) gets
> confused when the battery is added later, or something isn't initialized yet
> on login when Plasmashell starts initially but works later.
> 
> Did this happen after suspend or on fresh login?

I didn't notice when it started happening. I don't usually use my system on battery power, so it was running for 5 days until I realised I wasn't seeing the battery icon.
Comment 7 Riccardo Robecchi 2021-03-15 17:48:12 UTC
The same happens to me on my tablet (Teclast X98 Pro). Restarting Plasma does fix the issue.
Comment 8 Nate Graham 2021-03-22 03:42:51 UTC

*** This bug has been marked as a duplicate of bug 350365 ***