Summary: | battery applet shows no battery after suspend w/o battery | ||
---|---|---|---|
Product: | [Unmaintained] plasma4 | Reporter: | Jiri Slaby <jirislaby> |
Component: | widget-battery | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | cfeck, flateric, lukas, viranch.mehta |
Priority: | NOR | ||
Version: | 4.10.0 | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kde-workspace/ac326b8a57b32758d8b7b7ca89069279679e1d32 | Version Fixed In: | 4.10.3 |
Sentry Crash Report: | |||
Attachments: |
fix for that issue
fix, try 2 |
Description
Jiri Slaby
2013-03-06 09:31:33 UTC
FWIW (all run as a user running KDE) $ solid-hardware nonportableinfo /org/freedesktop/UPower/devices/battery_BAT0 udi = '/org/freedesktop/UPower/devices/battery_BAT0' Capacity = '99.002574002574' (string) Energy = '19.82' (string) EnergyEmpty = '0' (string) EnergyFull = '61.54' (string) EnergyFullDesign = '62.16' (string) EnergyRate = '5.448' (string) HasHistory = true (bool) HasStatistics = true (bool) IsPresent = true (bool) IsRechargeable = true (bool) Luminosity = '0' (string) Model = '45N1023' (string) NativePath = '/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/PNP0C0A:00/power_supply/BAT0' (string) Online = false (bool) Percentage = '32.2066948326292' (string) PowerSupply = true (bool) RecallNotice = false (bool) RecallUrl = '' (string) RecallVendor = '' (string) Serial = '867' (string) State = 2 (0x2) (uint) Technology = 1 (0x1) (uint) TimeToEmpty = 13096 (0x3328) (qlonglong) TimeToFull = 0 (0x0) (qlonglong) Type = 2 (0x2) (uint) UpdateTime = 1362562414 (0x51370d6e) (qulonglong) Vendor = 'SANYO' (string) Voltage = '11.233' (string) Same problem on KDE 4.10.1 - distro ArchLinux. One next simmilar problem. When KDE is started without battery and battery is plugged later, the applet still shows "no battery status". If KDE is started with plugged battery the applet works well. Version: KDE 4.10.1 Reproducible: Always Ok, I narrowed it a bit. plasmaengineexplorer shows correct battery status when obtained from powermanagement. There is only a problem in the battery plugin proper when accessing "old" data. * When the plasmoid is run in plasmoidviewer, it shows correct status. * When I remove all instances of the plasmoid and re-add it, it works OK. Otherwise printing to a console from within the plugin shows, that the data from powermanagement is obsolete: print("per cent = " + percent); print("batt = " + pmSource.data["Battery"]["Has Battery"]); print("batt0 = " + pmSource.data["Battery0"]["Percent"]); per cent = 0 batt = true file:///usr/share/kde4/apps/plasma/plasmoids/battery/contents/ui/batterymonitor.qml:200: TypeError: Result of expression 'pmSource.data["Battery0"]' [undefined] is not an object. whereas the data is there in the explorer above (and is printed when either of the two workarounds above is used). Lukas, any ideas? It looks like your patch to disconnect/re-connect to the data source should be used... Which patch do you mean? (In reply to comment #5) > Which patch do you mean? I thought about something like this: https://bugs.kde.org/show_bug.cgi?id=301033#c44 But I'm not sure at all. It was jsut shot in the dark. Is there any way to "reload" the data source? Yeah, having this in /usr/share/kde4/apps/plasma/plasmoids/battery/contents/ui/batterymonitor.qml property QtObject pmSource: PlasmaCore.DataSource { id: pmSource engine: "powermanagement" connectedSources: sources onDataChanged: { Logic.updateTooltip(); Logic.updateBrightness(); } onNewData: { print("NEW src1=" + sourceName); } onSourceAdded: { print("NEW src2=" + source); if (source == "AC Adapter" || source == "Battery" || source == "Battery0") { connectSource(source) } } } seems to work... It was removed by the commit below, which is bogus... commit d7b04c0732c538957aa8a2bf9d53bd98a61eab13 Author: Viranch Mehta <viranch.mehta@gmail.com> Date: Tue Jul 10 06:15:03 2012 +0530 Simply use connectedSources: sources for battery monitor instead of connecti ng sourceAdded/sourceRemoved signals Created attachment 78752 [details]
fix for that issue
(In reply to comment #9) > Created attachment 78752 [details] > fix for that issue Actually not really. Needs more than that. With this patch, it only fixes newly added plasmoids (no need to remove all now). (In reply to comment #10) > (In reply to comment #9) > > Created attachment 78752 [details] > > fix for that issue > > Actually not really. Needs more than that. With this patch, it only fixes > newly added plasmoids (no need to remove all now). There is still the question if there is a way to reconnect to the data source. The patch I pasted here improves nothing. Battery0 *is* in the connected sources even when the battery is not there, so the commit above changed the behavior in no way. Created attachment 78753 [details] fix, try 2 (In reply to comment #11) > The patch I pasted here improves nothing. Not really, it makes it actually work in plasmoidviewer and is a pre-requisite for the fix. > Battery0 *is* in the connected sources even when the battery is not there And I think this is the bug... Why is there Battery0 as a connected source, whereas there is no Battery0 data in powermanagement? I have to disconnect+re-connect the source to get it working. See the attached patch. Now, it works flawlessly. For me, fix number 2 works fine on kde 4.10.2... Git commit 3e9f349f5eef146ded11affd6a98c3b1c1e44510 by Lukáš Tinkl. Committed on 09/04/2013 at 18:18. Pushed by lukas into branch 'KDE/4.10'. fix #316213 - battery applet shows no battery after suspend w/o battery M +14 -2 plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml http://commits.kde.org/kde-workspace/3e9f349f5eef146ded11affd6a98c3b1c1e44510 Git commit ac326b8a57b32758d8b7b7ca89069279679e1d32 by Lukáš Tinkl. Committed on 09/04/2013 at 18:18. Pushed by lukas into branch 'master'. fix #316213 - battery applet shows no battery after suspend w/o battery M +3 -2 plasma/generic/applets/batterymonitor/contents/ui/batterymonitor.qml http://commits.kde.org/kde-workspace/ac326b8a57b32758d8b7b7ca89069279679e1d32 *** Bug 302310 has been marked as a duplicate of this bug. *** |