LoLei / razer-cli

CLI for configuring Razer devices
GNU General Public License v3.0
81 stars 11 forks source link

Wave effect speed controll missing #73

Open AblakfosoMolyadek opened 1 year ago

AblakfosoMolyadek commented 1 year ago

I wanted to mess around with the speed of the wave effect. (I wanted to slow it down a bit so it's not that 'flashy'). But it's not an option, as it is on the windows version of synapse. Then I wanted to edit the files responsible for the effects, but I couldn't find it out how to do it (& where to find it) (it's a skill issue of my side I guess). Can you add the feature of changing the speed of the wave effect to the app, or give advice how I could do it on my own?

sk8ersteve commented 12 months ago

Edit: upon further inspection, there are no specific methods for changing speed in the open-source driver. This might be a driver limitation. Looking into it.

You can start by checking how this project sets other device properties: https://github.com/LoLei/razer-cli/tree/master/razer_cli/razer_cli/setter. I see extensive use of getattr which was confusing for me at first since I don't use Python a lot, but now I see it is just a way to programmatically specify which method you want to call. For some device functions, this isn't necessary but for lighting effects, it is because the open-source driver has different names for different lighting regions per device and for different effects and makes these part of the function names. For example, to change the light effect on my mouse, the methods are set_logo_breath(), set_logo_spectrum(), set_logo_static(), etc.

You can find these method names for your device in the open-source driver here (I'm guessing it's a keyboard so check keyboards.py): https://github.com/openrazer/openrazer/blob/master/daemon/openrazer_daemon/hardware/

Then you can work your way up from there figuring out how to add a command line arg to razer-cli and appropriately modify the call through up to the appropriate setter class.

sk8ersteve commented 12 months ago

Looks like it is currently a limitation in the driver: https://github.com/openrazer/openrazer/blob/master/daemon/openrazer_daemon/dbus_services/dbus_methods/chroma_keyboard.py#L222

Looks like this would be your starting point: https://github.com/openrazer/openrazer/blob/29bbf766df429ca104a9919fdbd8bdccc1e4424d/driver/razerkbd_driver.c#L1547

https://github.com/openrazer/openrazer/blob/29bbf766df429ca104a9919fdbd8bdccc1e4424d/driver/razerchromacommon.c#L532

You'd want to modify the function definition in razerchromacommon.c/h to include a speed parameter and then modify razerkbd_driver.c/h to call it with a user specified value for only your keyboard, if you want to potentially upstream the fix. I can help you install the driver on Arch Linux. For that, this page is helpful: https://github.com/openrazer/openrazer/wiki/Building-a-package#build-packages-from-a-different-github-repository.

LoLei commented 12 months ago

Thanks for the help @sk8ersteve 🙏🏻

AblakfosoMolyadek commented 12 months ago

Thanks @sk8ersteve, your help is really appreciated! I'm an absolute noob for coding (I just started learning it), so it's a bit too advanced for me at the moment. But I'll come back to it in a few weeks or (months), to see if I can solve it myself. (Will be a good exercise for me)