Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one device manageable at a time? #219

Closed
Aditya-Tolikar opened this issue Sep 26, 2023 · 4 comments
Closed

Only one device manageable at a time? #219

Aditya-Tolikar opened this issue Sep 26, 2023 · 4 comments
Labels

Comments

@Aditya-Tolikar
Copy link

Observation

I have connected 2 mice at the same time. Rival 110 and Rival 3
As seen in the output of rivalcfg --help, I only see options for Rival 3

❯ rivalcfg --help
usage: rivalcfg [-h] [--list] [--version] [--no-save] [--update-udev] [--print-udev] [--print-debug] [-s SENSITIVITY] [-p POLLING_RATE] [--strip-top-color Z1_COLOR] [--strip-middle-color Z2_COLOR] [--strip-bottom-color Z3_COLOR]
                [-c LOGO_COLOR] [-e LIGHT_EFFECT] [-b BUTTONS_MAPPING] [-r] [--firmware-version]

options:
  -h, --help            show this help message and exit
  --list                List supported devices and exit
  --version             show program's version number and exit
  --no-save             Do not persist settings in the internal device memory
  --update-udev         Updates udev rules (Linux only, requires to be run as root)
  --print-udev          Prints udev rules and exit
  --print-debug         Prints debug information and exit

SteelSeries Rival 3 Options:
  -s SENSITIVITY, --sensitivity SENSITIVITY
                        Set sensitivity preset (DPI) (up to 5 settings, from 200 dpi to 8500 dpi, default: '800, 1600')
  -p POLLING_RATE, --polling-rate POLLING_RATE
                        Set polling rate (Hz) (values: 125, 250, 500, 1000, default: 1000)
  --strip-top-color Z1_COLOR, --z1 Z1_COLOR
                        Set the color of the top LED of the strip (e.g. red, #ff0000, ff0000, #f00, f00, default: red)
  --strip-middle-color Z2_COLOR, --z2 Z2_COLOR
                        Set the color of the middle LED of the strip (e.g. red, #ff0000, ff0000, #f00, f00, default: lime)
  --strip-bottom-color Z3_COLOR, --z3 Z3_COLOR
                        Set the color of the bottom LED of the strip (e.g. red, #ff0000, ff0000, #f00, f00, default: blue)
  -c LOGO_COLOR, --logo-color LOGO_COLOR, --z4 LOGO_COLOR
                        Set the color of the logo LED (e.g. red, #ff0000, ff0000, #f00, f00, default: purple)
  -e LIGHT_EFFECT, --light-effect LIGHT_EFFECT
                        Set the light effect (values: rainbow-shift, breath-fast, breath, breath-slow, steady, rainbow-breath, disco, default: steady)
  -b BUTTONS_MAPPING, --buttons BUTTONS_MAPPING
                        Set the mapping of the buttons (default: buttons(button1=button1; button2=button2; button3=button3; button4=button4; button5=button5; button6=dpi; scrollup=scrollup; scrolldown=scrolldown; layout=qwerty))
  -r, --reset           Reset all settings to their factory default
  --firmware-version    Print the firmware version of the mouse and exit

Please report any bug on Github: https://github.com/flozz/rivalcfg/issues

If I disconnect the Rival 3, rivalcfg --help will now show options for Rival 110, but it doesn't seem that I can do both at a time.

Expectation

I was hoping to be able to do so for multiple supported devices at the same time, so that I could let the user check all of them on the fly (maybe in a tabbed or list format) in the GUI.
I am also hoping to be able to just invoke the CLI instead of having to invoke Python functions from the C++ code.
Is it possible to interface with multiple devices in such a way or would I have to look into the Python API?

Is it possible to trivially add the functionality if it is not there right now?

Is a GUI already under development? Where do I go for it?

Installation information

yay rivalcfg
1 aur/rivalcfg 4.10.0-2 (+15 0.01) (Installed)
    CLI tool and Python library to configure SteelSeries gaming mice

System information

❯ rivalcfg --print-debug

RIVALCFG
========
Version: 4.10.0
udev rules installed: True
udev rules up to date: True
Installation path: /usr/lib/python3.11/site-packages/rivalcfg

OPERATING SYSTEM
================
OS: Linux
Platform: Linux-6.5.4-zen2-1-zen-x86_64-with-glibc2.38
Version: #1 ZEN SMP PREEMPT_DYNAMIC Thu, 21 Sep 2023 12:54:31 +0000
Distribution issue: EndeavourOS Linux \r (\l)

PYTHON
======
Python version: 3.11.5
HIDAPI version: 0.14.0

PLUGGED STEELSERIES DEVICES ENDPOINTS
=====================================
1038:1729 | 00 | SteelSeries Rival 110 Gaming Mouse (firmware v0)
1038:1729 | 01 | SteelSeries Rival 110 Gaming Mouse (firmware v0)
1038:1729 | 01 | SteelSeries Rival 110 Gaming Mouse (firmware v0)
1038:1824 | 00 | SteelSeries Rival 3 (firmware v36.0)
1038:1824 | 00 | SteelSeries Rival 3 (firmware v36.0)
1038:1824 | 01 | SteelSeries Rival 3 (firmware v36.0)
1038:1824 | 01 | SteelSeries Rival 3 (firmware v36.0)
1038:1824 | 02 | SteelSeries Rival 3 (firmware v36.0)
1038:1824 | 03 | SteelSeries Rival 3 (firmware v36.0)
@flozz
Copy link
Owner

flozz commented Sep 27, 2023

The CLI only supports one device: it is simple to implement this way (and it is rare to have multiple mice connected to a PC).

However, it is possible to force which mouse is detected using the RIVALCFG_PROFILE environment variable: https://flozz.github.io/rivalcfg/env.html#rivalcfg-profile

@Aditya-Tolikar
Copy link
Author

Thanks, looks like I can use RIVALCFG_PROFILE along with the debug output to implement multiple device support in a GUI.
Another related question here, though, is how to determine which of the endpoints given by rivalcfg --print-debug to set in the environment variable.

@flozz
Copy link
Owner

flozz commented Sep 28, 2023

Another related question here, though, is how to determine which of the endpoints given by rivalcfg --print-debug to set in the environment variable.

All endpoints of the same device have the same VendorID and ProductID. The exact endpoint to use is determined internally by Rivalcfg (it is configured in devices profiles).

But to list all available devices, please do not use the output of --print-debug. It is meant for human and subject to change if I need to print more info one day...

Instead you can use the Python API (you can call directly some Python code from the CLI):

python -c "import json ; import rivalcfg.devices ; print(json.dumps(list(rivalcfg.devices.list_plugged_devices())))"

This will give you a standard JSON output that will be easier to parse:

[{"vendor_id": 4152, "product_id": 5929, "name": "SteelSeries Rival 110"}]

@Aditya-Tolikar
Copy link
Author

Thanks, I'll do it this way then.
Perhaps I should start with the python API itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants