Bug 317404 - doesn't show battery status for other devices like mouse, keyboard, trackball
Summary: doesn't show battery status for other devices like mouse, keyboard, trackball
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-battery (show other bugs)
Version: 4.10.1
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-26 19:49 UTC by Arkadiusz Miskiewicz
Modified: 2013-05-23 20:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments
power management view (49.15 KB, image/jpeg)
2013-05-20 16:23 UTC, Arkadiusz Miskiewicz
Details
to narrow (12.96 KB, image/jpeg)
2013-05-20 19:34 UTC, Arkadiusz Miskiewicz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arkadiusz Miskiewicz 2013-03-26 19:49:40 UTC
Current git version of upower and upcoming kdelibs 4.10.2 (https://bugs.kde.org/show_bug.cgi?id=317400) will be able to provide battery information through solid for Logitech wireless devices (mouse, keyboard, trackball).

Unfortunately battery applet is not capable of displaying status for non-regular batteries. It only shows battery status for main laptop batteries.

This is feature request about adding such support.

Suggestions about implementation:
For example in one of my laptop with external wireless keyboard and mouse connected I would expect three battery icons by default (one for laptop battery, one for keyboard and one for mouse). "Show the state for each battery present" should work for laptop batteries only since aggregating mouse/keyboard batteries with main laptop battery makes little sense.

Reproducible: Always
Comment 1 Kai Uwe Broulik 2013-05-13 15:45:57 UTC
Working on it :-)
Comment 2 Kai Uwe Broulik 2013-05-20 13:10:09 UTC
Git commit 6fea11b80b78c6b734f04043a8565a5a1e9154c3
Committed on 16/05/2013 at 15:51.
Pushed by broulik into branch 'master'.

Improve Battery Monitor with multiple batteries: 
- Show Battery Name, if available, instead of just Battery 1, Battery 2, 
- Don't add non-power-supply batteries to the overall percentage 
- Drop "Show battery status for each battery", it is now always on, 
given that in systray it only shows one icon anyway and now does that 
right, and if there's a mouse you wouldn't want it to be not shown, 
so it would show them anyway which is a contradiction to the setting 

REVIEW: 110431 

http://quickgit.kde.org/?p=kde-workspace.git&a=commit&h=6fea11b80b78c6b734f04043a8565a5a1e9154c3
Comment 3 Arkadiusz Miskiewicz 2013-05-20 13:40:39 UTC
Applied the patch to 4.10.3 and unfortunately I'm seeing only main notebook battery icon. No icon for the mouse battery. "solid-hardware details" sees it

$  solid-hardware details '/org/freedesktop/UPower/devices/mouse_0003o046DoC52Bx0004'
udi = '/org/freedesktop/UPower/devices/mouse_0003o046DoC52Bx0004'
  parent = '/org/freedesktop/UPower'  (string)
  vendor = 'Logitech, Inc.'  (string)
  product = 'M570'  (string)
  description = 'Unknown Battery'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'MouseBattery'  (0x4)  (enum)
  Battery.chargePercent = 35  (0x23)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'Discharging'  (0x2)  (enum)


Is some additional change needed?
Comment 4 Arkadiusz Miskiewicz 2013-05-20 13:46:53 UTC
Another issue is that main battery icon shows "0%" while on popup shows correctly "Battery: 100%".
Comment 5 Kai Uwe Broulik 2013-05-20 13:55:08 UTC
In the tray there will always be only one icon. When placed on the desktop it will show an icon per battery.

Can you run plasmaengineexplorer (you probably need to install plasmate first) and go to the power management engine and look if the battery is present there and listed with correct values?

Thanks for helping!
Comment 6 Kai Uwe Broulik 2013-05-20 14:00:43 UTC
Oh, I forgot, that patch also requires two other patches:
http://quickgit.kde.org/?p=kdelibs.git&a=commit&h=b86adffd69a972f612e0fb00f8c4e8154142c730
So Solid knows about the power supply state

And
http://quickgit.kde.org/?p=kde-workspace.git&a=commit&h=921d6822b7451c993237db2bc6c76b851d7d7dc6
Which tells it to the power management dataengine.

Sorry, could you try again? :-)
Comment 7 Arkadiusz Miskiewicz 2013-05-20 16:23:12 UTC
Created attachment 79977 [details]
power management view

Now "100%" test is correctly displayed on taskbar icon. Popup also shows correct value and name of the battery (model only, without vendor name so "42T4678" in my case. vendor + model would be nicer like "Panasonic 42T4678").

Unfortunately no mouse battery icon even when battery widget added to desktop. plasmaengineexplorer screenshot attached.

Why no mouse icon on taskbar? I don't even need to see it all time but only when low on battery. So by default I see main battery icon + other devices icons appear when these are low on battery.
Comment 8 Kai Uwe Broulik 2013-05-20 17:00:55 UTC
Thanks for your feedback!

Not showing the vendor name is intended. Frankly, I only tested with an Apple Magic Mouse which can have a custom name set and so I didn't consider the vendor name needed. But seems we do need it.

Weird, the battery doesnt show up in the engine explorer, so it is not shown in the battery monitor. Can you post the output of upower -d so I can see what upower reports.
Comment 9 Arkadiusz Miskiewicz 2013-05-20 17:02:43 UTC
[arekm@t400 ~]$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/ACPI0003:00/power_supply/AC
  power supply:         yes
  updated:              Mon May 20 18:15:27 2013 (2816 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             yes

Device: /org/freedesktop/UPower/devices/mouse_0003o046DoC52Bx0004
  native-path:          /sys/devices/pci0000:00/0000:00:1d.0/usb6/6-1/6-1:1.2/0003:046D:C52B.0003/0003:046D:C52B.0004
  vendor:               Logitech, Inc.
  model:                M570
  power supply:         no
  updated:              Mon May 20 19:02:02 2013 (21 seconds ago)
  has history:          yes
  has statistics:       no
  mouse
    present:             yes
    rechargeable:        yes
    state:               discharging
    percentage:          45%

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
  vendor:               Panasonic
  model:                42T4678
  serial:               1325
  power supply:         yes
  updated:              Mon May 20 19:02:01 2013 (22 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              43.79 Wh
    energy-empty:        0 Wh
    energy-full:         44.76 Wh
    energy-full-design:  56.16 Wh
    energy-rate:         8.919 W
    voltage:             12.432 V
    percentage:          97.8329%
    capacity:            79.7009%
    technology:          lithium-ion

Daemon:
  daemon-version:  0.9.20
  can-suspend:     no
  can-hibernate:   no
  on-battery:      no
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no
[arekm@t400 ~]$
Comment 10 Kai Uwe Broulik 2013-05-20 17:04:16 UTC
If you are good at Inkscape a suitable system tray icon for peripheral status would be welcome ;-)

Btw Logitech M570 is the trackball, right? I too have it but how did you manage to have it report its battery status? It doesnt here. Would really make my work easier.
Comment 11 Arkadiusz Miskiewicz 2013-05-20 17:09:56 UTC
I'm far from even being inskcape newbie ;)

Yes, trackball. Use upower from upstream git or apply this patch
http://git.pld-linux.org/gitweb.cgi?p=packages/upower.git;a=blob_plain;f=upower-fixes.patch;hb=HEAD

btw. arekm@freenode
Comment 12 Kai Uwe Broulik 2013-05-20 18:53:28 UTC
Git commit 7087214d5e88fc853d0fcd6ca19a0d0f01d81abe by Kai Uwe Broulik.
Committed on 20/05/2013 at 20:52.
Pushed by broulik into branch 'master'.

Consider All The Batteries [tm]

M  +20   -23   plasma/generic/dataengines/powermanagement/powermanagementengine.cpp

http://commits.kde.org/kde-workspace/7087214d5e88fc853d0fcd6ca19a0d0f01d81abe
Comment 13 Kai Uwe Broulik 2013-05-20 19:00:02 UTC
Git commit a8e3b397507d38bf936ad573f3b90c6dbd0fed5a by Kai Uwe Broulik.
Committed on 20/05/2013 at 20:59.
Pushed by broulik into branch 'master'.

Show Battery Vendor if available

M  +12   -5    plasma/generic/dataengines/powermanagement/powermanagementengine.cpp

http://commits.kde.org/kde-workspace/a8e3b397507d38bf936ad573f3b90c6dbd0fed5a
Comment 14 Arkadiusz Miskiewicz 2013-05-20 19:34:27 UTC
Created attachment 79981 [details]
to narrow

Works now, thanks!

Should I file a separate bug for displaying icon(s) in low-battery mode for non primary batteries?

One tiny issue. When mouse is on top of applet the information screen appears (see screenshot) which is too narrow. Probably can be fixed to newer go into 2-text lines info  for single battery (see screenshot).
Comment 15 Kai Uwe Broulik 2013-05-20 19:40:22 UTC
Yes, please, so I don't forget (and so that you can clarify in more detail what you mean), and assign it to me then.
Now that my Logitech trackball is properly recognized I can give it a lot more testing and UX polishing. Haven't looked in the desktop case (non-power-supply batteries only) at all yet.

About the tooltip: I guess that's a plasma bug, where it tries to find a suitable size for the tooltip and fails. It's just a dumb string listing all the batteries separated by <br>, maybe I can workaround using <pre> tag and/or &nbsp; (ie. non-breaking-space).
Comment 16 Kai Uwe Broulik 2013-05-20 19:52:55 UTC
Git commit 175e902b88a2c6a1c1ca37f428208e83c1660937 by Kai Uwe Broulik.
Committed on 20/05/2013 at 21:52.
Pushed by broulik into branch 'master'.

No linebreak in tooltip. We do them manually anyways.

M  +1    -1    plasma/generic/applets/batterymonitor/contents/code/logic.js

http://commits.kde.org/kde-workspace/175e902b88a2c6a1c1ca37f428208e83c1660937
Comment 17 Arkadiusz Miskiewicz 2013-05-20 19:57:25 UTC
Added - #320064. Unfortunately bugzilla won't allow me to assign it to you.
Comment 18 Arkadiusz Miskiewicz 2013-05-21 06:20:58 UTC
There seem to be another issue. Battery applet doesn't notice that new battery is "connected" or "disconnected". plasma engine explorer sees that correctly but not applet.

How to reproduce:
- disconnect mouse
- look at applet, it still shows battery info
- remove battery applet
- add battery applet again (now it doesn't show mouse battery correctly)
- connect mouse
- battery applet doesn't see new battery
- remove && add applet - new battery is seen again
Comment 19 Kai Uwe Broulik 2013-05-21 08:44:44 UTC
Git commit 2fd181ef31382e071126ea2a401506d3b1aaa4af by Kai Uwe Broulik.
Committed on 21/05/2013 at 10:43.
Pushed by broulik into branch 'master'.

Consider All The Batteries[tm]
When a new device was added, it wasn't added to the dataengine right away

M  +1    -2    plasma/generic/dataengines/powermanagement/powermanagementengine.cpp

http://commits.kde.org/kde-workspace/2fd181ef31382e071126ea2a401506d3b1aaa4af
Comment 20 Arkadiusz Miskiewicz 2013-05-21 09:29:06 UTC
Now removal of mouse was noticed immediately but plugging it back in didn't result with battery applet displaying info for mouse battery.

plasma engine explorer sees it correctly.
Comment 21 Arkadiusz Miskiewicz 2013-05-23 20:45:15 UTC
Should I open separate bug for this (comment #20), too?

Running this for few days and applet didn't notice new battery for all that time.