The battery monitor widget does not show batteries of newly added devices (e.g. if a wireless mouse is switched on after the battery monitor widget has been loaded).
Steps to Reproduce:
1. Log into KDE, but do not connect e.g. a wireless mouse device
2. After KDE and the widget has been loaded, turn on device
3. Check in battery monitor
List of available batteries is not updated (upower --monitor-detail does show it, though).
List of available batteries is updated
Can you check whether the new battery immediately appears in plasmaengineexplorer too? (afaik it's now shipped with plasmate, no longer kde-workspace by default).
Open plasmaengineexplorer, navigate to the powermanagement engine, and *then* turn on your device (so we can see that the signal stuff works, otherwise it just re-reads the devices).
I checked as requested: Yes, the new battery appears immediately in plasmaengineexplorer.
I did some more tests: a battery which is available at the time the widget is loaded will be shown, even if it's removed and added again. But batteries of devices, which where added *after* the widget was loaded will never be shown.
Created attachment 82334 [details]
Battery monitor connectSource patch
Can you test whether this patch helps (and has no unwanted side-effects, eg. it still all works after suspending the machine etc)? Don't have a battery-powered machine near me atm. Thanks for your help!
I applied your changes and tested it - but unfortunately, it has some unwanted side-effects:
* Only the battery, which was added last, is shown
* If any battery is removed, the missing battery symbol is shown
Ok, so I guess that if-clause was there for a reason :D
I need to more thoroughly test this then on a machine with batteries.
Thanks for testing!
*** Bug 326648 has been marked as a duplicate of this bug. ***
Created attachment 83148 [details]
Battery monitor connectSource patch vol. 2
This patch worked for me. Can you verify, please, so I can push it in time for 4.11.3? Thanks!
If somebody gives me instructions how to incorporate the patch, I could give a try.
OK, I have managed to update. So far it seems to work fine now!
@Christian: Can you please test this patch as the last one didn't work for you. I cannot reliably trigger the problem here :-(
@Kai: thanks for the new patch. I applied and tested it, but there are still some problems, specially when batteries are removed.
* Adding a new battery works
* When the battery, which was added first, is removed, then all other battery icons are removed, too
I will provide detailed steps in the next days.
Have you had any chance to play around a bit? :-) I cannot test your use case "Plug out the first battery and all the others disappear as well", as I only have a mouse which I could plug in and out which naturally comes after the built-in battery. :/
I did not observe any problems while trying in&out, etc. Works like a charm. On the other hand, I did not extensively use the second battery lately.
I'm having a slightly different problem but seems like it could be related.
I just migrated my homedir from a desktop running Fedora 17 to a laptop running Fedora 20 beta (KDE platform 4.11.3). I don't have a wireless mouse, but the desktop had a USB-attached UPS that registered as a battery. But now on the laptop, the battery plasmoid shows a red X and "No batteries available". The laptop battery is visible in upower and plasmaengineexplorer, and the battery monitor works if I log in to a fresh user account. There just doesn't seem to be a way to get the previously configured plasmoid to refresh itself.
Just noticed my battery monitor was working; seems to have found the new battery all by itself. I had installed some package updates but nothing KDE-related. Only other thing I can think of is I suspended and resumed the laptop, however I had done that before as well as rebooting.
Can you all please test the patches I previously added to this bug report and see if any issues persist, especially when removing and adding the first battery (which is claimed to make all others disappear too). I want this fixed soon but I'm clueless :-/
OK, I tried playing around with both batteries and found only one minor issue:
after removing both batteries the correct icon with a red X appears, but hovering over with a cursor results in a popup/tooltip displaying both batteries (for example: battery 1: 100%, battery 2: 99%). Clicking on it displays a correct menu; only an automatic tooltip has a memory issue. Note, the tooltip is already wrong after one out of two being removed. To fix it: both batteries should be removed and, at least one, put back in.
Putting one or two batteries back in fixes everything and it works as expected (after ~5-s delay).
In short, for me the patch works fine, except a minor problem.
Thanks for your feedback! I guess I forgot an updateLogic call which updates the tooltip there. Will post a new patch tomorrow.
Could at least the patch vol. 2 be submitted to the upstream?
As it is annoying to apply a patch each time after a KDE update when the file gets replaced.
PS. vol. 3 with a tooltip fix might be even better
Review Request 115409.
Maybe somebody has a better clue/solution ;)
Git commit edd82448a60c36a66afec94cca1ba07741e1a121 by Kai Uwe Broulik.
Committed on 15/02/2014 at 22:18.
Pushed by broulik into branch 'KDE/4.11'.
Try to fix battery detection at runtime
M +4 -12 plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml
*** Bug 251550 has been marked as a duplicate of this bug. ***