flozz / rivalcfg

CLI tool and Python library to configure SteelSeries gaming mice
https://flozz.github.io/rivalcfg/
Do What The F*ck You Want To Public License
792 stars 65 forks source link

Battery level shows 630% when mouse is off #187

Closed bokub closed 1 year ago

bokub commented 2 years ago

Bug description

What happened

rivalcfg --battery-level shows 630% when mouse is off or disconnected

2022-09-06_11-17

What was expected

A message saying the mouse is not connected

Step to reproduce

→ Always reproducible

  1. Plug a wireless Aerox 3 mouse
  2. Run rivalcfg --battery-level to see the real battery level
  3. Turn off the mouse using the little switch under the mouse
  4. Run rivalcfg --battery-level again

System information

RIVALCFG
========
Version: 4.6.0
udev rules installed: True
udev rules up to date: True
Installation path: /usr/local/lib/python3.8/dist-packages/rivalcfg

OPERATING SYSTEM
================
OS: Linux
Platform: Linux-5.15.0-46-generic-x86_64-with-glibc2.29
Version: #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022
Distribution issue: Ubuntu 20.04.5 LTS \n \l

PYTHON
======
Python version: 3.8.10
HIDAPI version: 0.12.0.post2

PLUGGED STEELSERIES DEVICES ENDPOINTS
=====================================
1038:1838 | 00 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:1838 | 01 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:1838 | 02 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:1838 | 03 | SteelSeries Aerox 3 Wireless (firmware v0)
1038:1838 | 04 | SteelSeries Aerox 3 Wireless (firmware v0)
flozz commented 2 years ago

Sadly, I have no way to reproduce this bug as I do not own this device. I only can guess there is a special value (probably 0xFF regarding the level you get) when the moues is off...

(0xFF & ~0b10000000 - 1) * 5   → 630

I will try to get more info :)

bokub commented 2 years ago

I do not own this device

I do, so don't hesitate if you want me to run commands that could help you !

Thank you :)

CMSplumbear commented 1 year ago

Same problem with a Prime Wireless. Indeed the second byte returned is 255 (0xff) if the mouse is off or sleeping.

I don't know what's returned in the first byte, but the value seems to always be 64 (0x40) in this case. It is 146 / 0x92 (= the command) when charging, and 210 / 0xD2 while discharging

Thanks a lot for writing rivalcfg!

flozz commented 1 year ago

Fixed by #212. It will be released in the next version :)