Solaar: Logitech g703 battery not detected/ unknown in GUI (feature BATTERY_VOLTAGE)

Created on 15 Oct 2019  路  71Comments  路  Source: pwr-Solaar/Solaar

Hello - I have a Logitech g703 mouse using the lightspeed receiver. Solaar detects the mouse but the battery is not detected.

I'm running Ubuntu 19.10 - kernel - 5.3.0-18-generic

$ solaar -d
06:29:15,579     INFO [MainThread] root: language en_GB (UTF-8), translations path None
06:29:15,670     INFO [MainThread] solaar.upower: connected to system dbus, watching for suspend/resume events
06:29:15,740     INFO [MainThread] solaar.listener: starting receiver listening threads
06:29:15,820     INFO [MainThread] solaar.listener: receiver event add DeviceInfo(path=u'/dev/hidraw8', vendor_id=u'046d', product_id=u'c539', serial=u'', release='3904', manufacturer='Logitech', product='USB Receiver', interface=2, driver=u'logitech-djreceiver')
06:29:16,734  WARNING [MainThread] logitech_receiver.base: timeout (0.90/0.90) on device 255 request {80B2} params []
06:29:16,735     INFO [ReceiverListener:hidraw8] logitech_receiver.listener: started with <LightspeedReceiver(/dev/hidraw8,15)> (15)
06:29:16,735     INFO [ReceiverListener:hidraw8] solaar.listener: <LightspeedReceiver(/dev/hidraw8,15)>: notifications listener has started (15)
06:29:16,739     INFO [ReceiverListener:hidraw8] logitech_receiver.receiver: <LightspeedReceiver(/dev/hidraw8,15)>: receiver notifications enabled => ('wireless', 'software present')
06:29:16,742     INFO [ReceiverListener:hidraw8] solaar.listener: status_changed <LightspeedReceiver(/dev/hidraw8,15)>: present, No paired devices. (0) 
06:29:16,755     INFO [ReceiverListener:hidraw8] logitech_receiver.receiver: <LightspeedReceiver(/dev/hidraw8,15)>: found new device 1 (4070)
06:29:16,755     INFO [ReceiverListener:hidraw8] solaar.listener: Notification(1,41,0C,B27040) triggered new device <PairedDevice(1,4070,G703)> (mouse)
06:29:16,883     INFO [ReceiverListener:hidraw8] solaar.listener: status_changed <LightspeedReceiver(/dev/hidraw8,15)>: present, 1 paired device. (0) 
06:29:16,946     INFO [ReceiverListener:hidraw8] solaar.configuration: saved {u'4070:AFE674F7': {u'dpi': 1600, u'_name': u'G703 Wired/Wireless Gaming Mouse'}, u'_version': u'1.0.1'} to /home/max/.config/solaar/config.json
06:29:16,966     INFO [ReceiverListener:hidraw8] solaar.listener: status_changed <PairedDevice(1,4070,G703)>: paired online, {'LINK ENCRYPTED': True} (1) 
$ solaar show
Unifying Receiver
  Device path  : /dev/hidraw8
  USB id       : 046d:c539
  Serial       : 4CA99F7C
    Firmware   : 39.04.B0036
    Bootloader : 02.09
    Other      : AA.BE
  Has 1 paired device(s) out of a maximum of 1.
  Notifications: wireless, software present (0x000900)
  Device activity counters: (empty)

  1: G703 Wired/Wireless Gaming Mouse
     Codename     : G703
     Kind         : mouse
     Wireless PID : 4070
     Protocol     : HID++ 4.2
     Polling rate : 8 ms (125Hz)
     Serial number: AFE674F7
          Firmware: MPM 14.02.B0007
        Bootloader: BOT 64.02.B0007
             Other: 
     The power switch is located on the base.
     Supports 29 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: unknown:1001           {1001}   
         5: unknown:1863           {1863}   internal, hidden
         6: unknown:18A1           {18A1}   internal, hidden
         7: unknown:1E00           {1E00}   hidden
         8: unknown:1E20           {1E20}   
         9: unknown:1EB0           {1EB0}   internal, hidden
        10: ADJUSTABLE DPI         {2201}   
        11: ANGLE SNAPPING         {2230}   
        12: SURFACE TUNING         {2240}   
        13: REPORT RATE            {8060}   
        14: ONBOARD PROFILES       {8100}   
        15: MOUSE BUTTON SPY       {8110}   
        16: unknown:1850           {1850}   internal, hidden
        17: unknown:00C2           {00C2}   
        18: unknown:1801           {1801}   internal, hidden
        19: unknown:1802           {1802}   internal, hidden
        20: unknown:1803           {1803}   internal, hidden
        21: unknown:1890           {1890}   internal, hidden
        22: unknown:1811           {1811}   internal, hidden
        23: unknown:8111           {8111}   
        24: COLOR LED EFECTS       {8070}   
        25: unknown:1809           {1809}   
        26: unknown:1830           {1830}   internal, hidden
        27: unknown:1805           {1805}   internal, hidden
        28: unknown:1806           {1806}   internal, hidden
     Battery status unavailable.

Any suggestions? Thanks very much

enhancement

All 71 comments

Yeah, it uses the 1001 feature. We need to add support for it.

Ah great - so at least a known issue.. Any idea on ETA?
thanks

Just an update to add a link to my post over in the ubuntu forums https://ubuntuforums.org/showthread.php?t=2429650

I actually sent the documentation for this feature in the kernel input mailing list. If someone wants to implement it go ahead, I don't have time right now.

Unfortunately I'm not a developer myself :( But thanks for notifying the kernel folk - hopefully someone will pick it up

@maxdraki looks like someone has already went to the trouble of implementing 0x1001 feature support, see here: https://www.spinics.net/lists/kernel/msg3296608.html for more. Not sure if/when it will be upstreamed into the mainline kernel though.

It has not been upstreamed yet and it's not ready.

Thanks for the update :)
I'm also waiting for kernel 5.4 on Ubuntu which I think should support this

No, this has not been upstreamed. It will not be present in Linux 5.4.

That's frustrating, but thanks for the update...

I am going to push for this. I already contacted the UPower guys to see what work is needed. After I get feedback I will make sure the kernel patch exports all the required information and push for it to be merged.

That would be amazing - thanks very much

Any word on this?

Also bumping for curiosty.

Looks like it will be upstreamed in kernel version 5.6 (if it passes further approval), see here for more. However, not sure what the progress is on the upower support.

Thanks for pointing out the update
That's frustrating - I'm guessing kernel 5.6 won't be released until March/ April - and probably won't hit Ubuntu until release 20.10.. :(
iirc upower support is dependent on the kernel update, no?

upower support depends on the kernel but still isn't done. On top of the kernel changes we need to add support in upower.

I sent a kernel patch yesterday fixing the battery reporting for these devices, which was broken. Hopefully, it will get merged in time for 5.6.

I also just merged 430b70711ba307f43751f6f6b8331e23690f0c6f which should show the voltage in solaar show.

Thanks a lot for the update

PR #632 should have added battery support for G703.

By back-porting the [be281368f297] on my current kernel 5.4.x in order to support the 1001 feature and using master branch I can see the battery voltage.

Next step is to translate this to % and show it on UI.

$ solaar show                                                                                                                                                                master
Unifying Receiver
  Device path  : /dev/hidraw5
  USB id       : 046d:c539
  Serial       : 88D69A4C
    Firmware   : 39.04.B0036
    Bootloader : 02.09
    Other      : AA.BE
  Has 1 paired device(s) out of a maximum of 1.
  Notifications: wireless, software present (0x000900)
  Device activity counters: (empty)

  1: G703 LIGHTSPEED Wireless Gaming Mouse w/ HERO
     Codename     : G703 LS
     Kind         : mouse
     Wireless PID : 4086
     Protocol     : HID++ 4.2
     Polling rate : 8 ms (125Hz)
     Serial number: 5E9E8163
        Bootloader: BL1 05.01.B0013
          Firmware: MPM 22.02.B0015
             Other:
     The power switch is located on the base.
     Supports 29 HID++ 2.0 features:
         0: ROOT                   {0000}
         1: FEATURE SET            {0001}
         2: DEVICE FW VERSION      {0003}
         3: DEVICE NAME            {0005}
         4: WIRELESS DEVICE STATUS {1D4B}
         5: RESET                  {0020}
         6: BATTERY VOLTAGE        {1001}
         7: RGB EFFECTS            {8071}
         8: ONBOARD PROFILES       {8100}
         9: MOUSE BUTTON SPY       {8110}
        10: REPORT RATE            {8060}
        11: ADJUSTABLE DPI         {2201}
        12: DFUCONTROL SIGNED      {00C2}
        13: DEVICE RESET           {1802}   internal, hidden
        14: unknown:1803           {1803}   internal, hidden
        15: OOBSTATE               {1805}   internal, hidden
        16: CONFIG DEVICE PROPS    {1806}   internal, hidden
        17: unknown:1811           {1811}   internal, hidden
        18: unknown:1830           {1830}   internal, hidden
        19: unknown:1890           {1890}   internal, hidden
        20: unknown:1891           {1891}   internal, hidden
        21: unknown:18A1           {18A1}   internal, hidden
        22: unknown:1801           {1801}   internal, hidden
        23: unknown:18B1           {18B1}   internal, hidden
        24: unknown:1DF3           {1DF3}   internal, hidden
        25: unknown:1E00           {1E00}   hidden
        26: unknown:1EB0           {1EB0}   internal, hidden
        27: unknown:1863           {1863}   internal, hidden
        28: unknown:1E22           {1E22}   internal, hidden
     Battery: 4160mV, Discharging.

That is just a Solaar change, the kernel doesn't have anything to do it that. That kernel patch exports the battery information to sysfs so that things like upower can pick it up.

That is just a Solaar change, the kernel doesn't have anything to do it that. That kernel patch exports the battery information to sysfs so that things like upower can pick it up.

Interesting - thanks for the clarification. Reporting the mV is I think the first step. The next is to integrate the device's battery curve (for example [G703 battery curve]) and calculate the percentage, right?

Is there any remaining problem for Solaar here?

Closing as likely addressed by PR #632 and no response from submitter.

Doen't work on current Arch Linux kernel (5.6.4). But I guess it's because of the version I'm using (1.0.1). Are there any plans to realease the 1.0.2 anytime soon or should I build it from git?

Please try from git. 1.0.2 should be released in the not too far distant future, but it would be nice to have confirmation that this bug has been fixed.

Built the git, solaar show now shows battery and state, but the UI says battery unknown.

Can you provide output from solaar show and a UI screenshot?

However, the ui says it's 1.0.1.

[foxie@foxie-home ~]$ solaar show
Lightspeed Receiver
  Device path  : /dev/hidraw3
  USB id       : 046d:c539
  Serial       : C4B998EF
    Firmware   : 39.04.B0036
    Bootloader : 02.09
    Other      : AA.BE
  Has 1 paired device(s) out of a maximum of 1.
  Notifications: wireless, software present (0x000900)
  Device activity counters: (empty)

  1: G703 LIGHTSPEED Wireless Gaming Mouse w/ HERO
     Codename     : G703 LS
     Kind         : mouse
     Wireless PID : 4086
     Protocol     : HID++ 4.2
     Polling rate : 8 ms (125Hz)
     Serial number: 280A638D
        Bootloader: BL1 05.00.B0011
          Firmware: MPM 22.00.B0011
             Other: 
     The power switch is located on the base.
     Supports 29 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: WIRELESS DEVICE STATUS {1D4B}   
         5: RESET                  {0020}   
         6: BATTERY VOLTAGE        {1001}   
         7: RGB EFFECTS            {8071}   
         8: ONBOARD PROFILES       {8100}   
         9: MOUSE BUTTON SPY       {8110}   
        10: REPORT RATE            {8060}   
        11: ADJUSTABLE DPI         {2201}   
        12: DFUCONTROL SIGNED      {00C2}   
        13: DEVICE RESET           {1802}   internal, hidden
        14: unknown:1803           {1803}   internal, hidden
        15: OOBSTATE               {1805}   internal, hidden
        16: CONFIG DEVICE PROPS    {1806}   internal, hidden
        17: unknown:1811           {1811}   internal, hidden
        18: unknown:1830           {1830}   internal, hidden
        19: unknown:1890           {1890}   internal, hidden
        20: unknown:1891           {1891}   internal, hidden
        21: unknown:18A1           {18A1}   internal, hidden
        22: unknown:1801           {1801}   internal, hidden
        23: unknown:18B1           {18B1}   internal, hidden
        24: unknown:1DF3           {1DF3}   internal, hidden
        25: unknown:1E00           {1E00}   hidden
        26: unknown:1EB0           {1EB0}   internal, hidden
        27: unknown:1863           {1863}   internal, hidden
        28: unknown:1E22           {1E22}   internal, hidden
     Battery: 3684mV, Discharging.

obr谩zok

OK. I see that there is no code in the UI to use the voltage information.
It looks as if adding this is not trivial. I'm going to reopen and tag this as an enhancement.

We need to use a voltage curve provided by Logitech. I have permission to use it, but someone needs to sit down and write the code.

For now I think we could start by just providing the voltage itself, and then add the battery percentage.

@thefoxie The release information mismatch in the UI is Issue #725. There is a PR in the queue to fix it.

I don't mind working on implementing the voltage curve, but I don't posses the required data.

I did try to debug with GHub to extract some information and got this back:
image

any plans on fixing this? I'm facing same issue with my g703

Fixing what? The current version of Solaar reports battery voltage, which is what the device reports. Turning that into an estimate of remaining battery capacity requires obtaining information from Logitech.
@FFY00 what's the status of obtaining this information?

Sorry to post on an old thread, but I'm not quite sure _where_ I should post this on the various projects involved.
I have a logitech g703 and I would like to get the battery _percentage_ and the _icon name_ - as normally reported by upower
I've recently updated to kernel 5.7.0-050700-generic
I can see the battery voltage in /sys/class/power_supply/hidpp_battery_*/uevent

POWER_SUPPLY_VOLTAGE_NOW=4159000

But upower does not report this value
solaar show does report the voltage:

Battery: 4159mV, Discharging.

But Solaar GUI does not
image

Any help - including where on which project I should raise this, would be gratefully received
What I would like to see is battery percentage, state and ideally the corresponding icon name - e.g. battery-level-40-charging-symbolic
(This is so I can create a little conky widget to keep an eye on the status and remind me to charge it before the damn thing runs out of juice!)
Thank you very much

We don't (currently) have a way of translating the voltage into an estimated percentage.
@FFY00 Do you know what the holdup in getting this information is?

That said, the voltage should be displayed in the UI even if there is no battery level information. That's a simple enhancement.

I pinged Logitech.

@maxdraki Please try PR #878 and see whether it helps with your issue.

To run PR #878, first clone Solaar if you have not already done so and cd to the clone directory. The first time you download the pull request, fetch it into a new branch and checkout that branch, as in:

git fetch origin pull/878/head:pull_878
git checkout pull_878

To download a new version of the pull request, pull it into your branch for the request, as in:

git checkout pull_878
git pull origin pull/878/head:pull_878

Thanks @pfps - looks like that works :+1:
Battery: 4107mV, discharging, average.
image
image

Now if we get the voltage curve/ % that would be amazing!

Thank you very much!

Hmmm - left it running overnight and this morning the GUI seems to be picking up the wrong field
image
CLI still OK
Battery: 4070mV, discharging, average.

And the voltage is back again :man_shrugging:
image
Maybe because the mouse had been hibernating?

Yes, Solaar is trying to be as informative as it can be. When your device is connected, Solaar will give the approximate level information in the form of the battery icon and the battery voltage. When the device is not connected but was connected a short time ago (in terms of battery life), Solaar will show the approximate level information in place of the voltage (as the voltage changes relatively quickly). When the device has been disconnected for a long period of time then Solaar will show an unknown battery level.

When your device is almost out of charge Solaar should pop up a notification and change the battery level to critical. This particular behaviour has probably never been tested so it would be useful to let your battery run down sometime while Solaar is connected and see whether this happens.

Another thing that hasn't been tested is whether the battery voltage that Solaar shows changes while Solaar is running. Can you determine whether this happens?

Hi @pfps - that makes sense, thanks.
I'll let my battery run down - probably tonight - and see if there's a notification - I'll revert here
And solaar is tracking the voltage changes - I'm tracking the battery status from cat /sys/class/power_supply/hidpp_battery_*/uevent - but there's nothing in upower for some reason. Should solaar change its icon as the voltage drops? I'm guessing not until you have the voltage curve info?

Your device should be producing HID++ 2.0 battery voltage notifications and Solaar should be responding to them so you should be seeing the voltage go lower and lower. When your device reports that the battery is at a critical level Solaar should change the icon, but that's the only icon change that should be happening - other changes (full to nearly full to average to low to critical) need the voltage curve information.

Hi @pfps - my mouse is flashing 'red' indicating that battery is getting to critical levels.. I haven't seen the battery voltage in solaar for a while probably because I use a kvm switch with my work laptop and so switch back and forth quite a lot. It's currently showing 'average' and the icon is the normal one.
cat /sys/class/power_supply/hidpp_battery_*/voltage_now shows 3673000

@pfps we can ask for the voltage when the device connects/wakes up, and then respond to the voltage notifications. This way the voltage should always be shown.

@maxdraki Can you paste output of solaar show? That should show the current battery information. But it is likely that your mouse's battery switched to a low level when the mouse was not being managed by Solaar so Solaar did not see the change-in-status notification. I'll see whether Solaar checks battery levels when a device connects.

@FFY00 There is code in Solaar to process battery voltage notifications so that part of the solution should be working. The problem might be that there is no code that checks battery status or voltage when devices connect.

@FFY00 Yes indeed, Solaar does not update battery status when a device reconnects unless there is no previous battery status. It should probably update battery status whenever a device comes online.

Hi @pfps - unfortunately I had to plug the mouse in while working as it was down to 3% (according to logitech's software - I have to use Windows for work :( )
But.. I have been collecting the battery level from solaar show for a while and I've attached the log - the first col is timestamp. The gaps are either when I've been working and so plugged into my laptop, or while I guess it's hibernating.. Should be some info you can use

Max
battery-volt.txt

solaar show should output three fields (voltage, status, and level). Please paste output for me to check.
What I was interested in seeing was whether the level changed (from average to critical, or something like that).

Unfortunately I wasn't collecting everything..

> solaar show
Lightspeed Receiver
  Device path  : /dev/hidraw9
  USB id       : 046d:c539
  Serial       : 4CA99F7C
    Firmware   : 39.06.B0040
    Bootloader : 02.09
    Other      : AA.BE
  Has 1 paired device(s) out of a maximum of 1.
  Notifications: wireless, software present (0x000900)
  Device activity counters: (empty)

 > 1: G703 Wired/Wireless Gaming Mouse
     Codename     : G703
     Kind         : mouse
     Wireless PID : 4070
     Protocol     : HID++ 4.2
     Polling rate : 1 ms (1000Hz)
     Serial number: AFE674F7
          Firmware: MPM 14.02.B0007
        Bootloader: BOT 64.02.B0007
             Other: 
     The power switch is located on the base.
     Supports 29 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
         3: DEVICE NAME            {0005}   
         4: BATTERY VOLTAGE        {1001}   
         5: unknown:1863           {1863}   internal, hidden
         6: unknown:18A1           {18A1}   internal, hidden
         7: unknown:1E00           {1E00}   hidden
         8: unknown:1E20           {1E20}   
         9: unknown:1EB0           {1EB0}   internal, hidden
        10: ADJUSTABLE DPI         {2201}   
            Sensitivity (DPI): 1000
        11: ANGLE SNAPPING         {2230}   
        12: SURFACE TUNING         {2240}   
        13: REPORT RATE            {8060}   
        14: ONBOARD PROFILES       {8100}   
        15: MOUSE BUTTON SPY       {8110}   
        16: unknown:1850           {1850}   internal, hidden
        17: DFUCONTROL SIGNED      {00C2}   
        18: unknown:1801           {1801}   internal, hidden
        19: DEVICE RESET           {1802}   internal, hidden
        20: unknown:1803           {1803}   internal, hidden
        21: unknown:1890           {1890}   internal, hidden
        22: unknown:1811           {1811}   internal, hidden
        23: LATENCY MONITORING     {8111}   
        24: COLOR LED EFFECTS      {8070}   
        25: unknown:1809           {1809}   
        26: unknown:1830           {1830}   internal, hidden
        27: OOBSTATE               {1805}   internal, hidden
        28: CONFIG DEVICE PROPS    {1806}   internal, hidden
     Battery: 4162mV, discharging, average.

If you are collecting the output, please also collect that last value - that's the one the is used to change the battery icon.
Solaar might also be changing the voltage displayed in the GUI, but I'm not completely sure that this is the case. Please let me know whether the voltage being displayed in the GUI follows the voltage from solaar show.

Will do - will send more info tomorrow, or when I have some more data

Here's a file with voltage, status and level - missing data is either when it was sleeping or it was plugged into my laptop. It looks like the GUI is displaying the correct voltage, but not all the time as far as I've noticed - if not the voltage, then "average". I've not noticed the icon change

battery-volt.txt

Still not seeing anything in upower -d, although as mentioned, /sys/class/power_supply/hidpp_battery_* is being updated :man_shrugging:

Solaar wasn't keeping good track of the battery voltage in the GUI. I've put in a pull request (#906) to do a better job of this. Can you try running this PR? Let me know if the battery voltage changes in the Solaar main window while the window is visible.

To run PR #906, first clone Solaar if you have not already done so and cd to the clone directory. The first time you download the pull request, fetch it into a new branch and checkout that branch, as in:

git fetch origin pull/906/head:pull_906
git checkout pull_906

To download a new version of the pull request, pull it into your branch for the request, as in:

git checkout pull_906
git pull origin pull/906/head:pull_906

Then, from that directory, run

bin/solaar

Seems to be working - I haven't closed the solaar window, although the display did sleep for a while..
2020-08-08_19-50

2020-08-08_20-58

Maybe spoke too soon - is it meant to update at every voltage change?
Battery: 3926mV, discharging, average.
image

I expect that your mouse is not notifying the GUI every time the voltage changes so the GUI is displaying the last value it was told about. To check for sure you can run Solaar with debugging on, as bin/solaar -dd. This will produce a lot of output. What you are looking for are lines that look something like:

... DEBUG [...:hidraw9] logitech_receiver.... => r[11 01 040? ......]

These are reports of the battery voltage (feature 04) for your mouse (device 01). If the ? is non-zero then this is a response to a request from Solaar. If the ? is zero then this is a spontaneous notification from the device about voltage change. The last part is the actual voltage data with the voltage in the first two bytes and some status flags in the next byte.

As your battery's voltage decreases these reports should show up from time to time and Solaar (with PR #906) should update the GUI with the reported voltage.

Thanks again @pfps - I've piped the debug info to a file in case it's useful
battery-debug.txt

Yes, very useful. There is a stupid bug in the PR. I've fixed the bug so can you download the new version of the PR and provide output of solaar -dd again?

Here we go again - hope I managed to update the PR properly (not really used git cli before!)
battery-debug.txt

Oops, my fault. The instructions I provided don't work because of the way I changed the PR. I'll send new instructions shortly.

What you need to do is:

git checkout pull_906
git fetch origin pull/906/head
git reset --hard FETCH_HEAD

Sorry for the incorrect instructions.

Thanks @pfps
Let's try again - lmk if there's a problem
battery-debug.txt

It looks as if the processing of battery voltage notifications is working correctly, but of course I can't see whether the voltage changes in the GUI. Is that happening? I see a voltage change in your logs so the device is reporting voltage changes quite regularly.

But you did uncover another issue. This issue shouldn't have changed how Solaar reports the battery voltage, but can you test out the newest version of PR #906?

Definitely seems to be working :) the GUI is updating the voltage.. debug info attached

battery-debug.txt

OK, I'll merge into the master branch.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jinmingjian picture jinmingjian  路  12Comments

AlexWayfer picture AlexWayfer  路  21Comments

asgrim picture asgrim  路  5Comments

Tomaszal picture Tomaszal  路  17Comments

mfraser picture mfraser  路  9Comments