Artemis-RGB / Artemis.Plugins

Repository containing official Artemis plugins
Other
31 stars 37 forks source link

Many fixes and additional layouts for Logitech keyboards and mice #164

Closed motabass closed 1 year ago

motabass commented 1 year ago

@RobertBeekman Hi. I`m curious how detected devices are mapped to a certain layout xml. Is it just comparing the Name attribute in the XML with the device name returned by RGB.NET or OpenRGB? Or is there more to it?

RobertBeekman commented 1 year ago

@RobertBeekman Hi. I`m curious how detected devices are mapped to a certain layout xml. Is it just comparing the Name attribute in the XML with the device name returned by RGB.NET or OpenRGB? Or is there more to it?

Hi,

Artemis doesn't use the name tag of the XML currently, you can use that to give the device a more user friendly name, if Artemis ever uses it it would only be in the UI.

Which file to load is based on the model reported by RGB.NET, with special characters replaced by a -

https://github.com/Artemis-RGB/Artemis/blob/6f7f49617525ede19bdb880ba0851315c6110109/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs#L60-L75

And https://github.com/Artemis-RGB/Artemis/blob/6f7f49617525ede19bdb880ba0851315c6110109/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs#L106-L120

motabass commented 1 year ago

Thanks for pointing this out.

It seems that with the current approach there has to be a layout file for every "variant" RGB.NET or OpenRGB detects. For example The G903 has to have 4 identical layouts for "G900, G903, G903 Lightspeed" reported by RGB.NET and an extra one for OpenRGB which reports "G903 Wired-Wireless Gaming Mouse".

Would it be possible to have for example only one layout file and declare aliases/reported names in the xml itself or in some extra file?

RobertBeekman commented 1 year ago

Device providers can override this behaviour so if these are all the same we can make the Logitech plugin treat it all as one. An example of that is here in Corsair

https://github.com/Artemis-RGB/Artemis.Plugins/blob/06efefe2b31fa4e16a200fbc39d99ed6962ddcf0/src/Devices/Artemis.Plugins.Devices.Corsair/CorsairDeviceProvider.cs#L81-L93

If you're not comfortable making the change I can do that for you, just give me the exact names and their 'main' name and I'll get it done :)

motabass commented 1 year ago

Well I'm a real noob in C# ;)

If you check the pull-request you get a good overview of the names because i created all possible for G903 in it

motabass commented 1 year ago

For G903 it would really be "G903", "G903 Lightspeed" and "G903 Wired-Wireless Gaming Mouse". G900 really is another model but has the same layout also.

The same is true for GXXX and GXXX HERO models. HERO models are just updated models with a new sensor but share the same layout.

Same for G403 and G703 which also share the same layout but one being wired the other wireless

btw: Thanks for your awesome work on this Project. It's by far the best RGB solution out of many

motabass commented 1 year ago

Everything in this pull-request is about aligning the layout files to the current behavior, consulting duplicate layout images and layouts, fixing file names.

I hope i've not put too many changes into this one;)

robercy commented 1 year ago

Dear @motabass, keep this greate Pull request proposal. You are in the right direction.

motabass commented 1 year ago

Hi. Since the last update of RGB.NET my G915 TKL is now detected correctly via the logitech device plugin ;)

But i saw that controlling the media-key leds is not working at all strangely. Any Ideas why this could be?

diogotr7 commented 1 year ago

Those keys are not available to control through the Logitech SDK.

motabass commented 1 year ago

Are you sure?

With the OpenRGB plugin it works just fine. Also with every other RGB Software i have tried as well as Logitech G HUB itself. Or aren't they using the Logitech SDK?

diogotr7 commented 1 year ago

It works with OpenRGB because OpenRGB doesn't use the Logitech SDK. LGHUB itself controls it directly, "every other software" is what, signal? That doesn't use the SDK, either.

motabass commented 1 year ago

OK. Thanks for making this clear. So if Logitech doesn't decide to add it in we won't be able to have it work through RGB.NET right?

robercy commented 1 year ago

Thanks, @motabass. My vote to approve ASAP.

motabass commented 1 year ago

@diogotr7 Hi. I was searching around for a solution and was asking myself if it would be possible to force the Logitech SDK into changing the media key LEDs by just passing the right "code" to either one the functions provided. ...Even though it is documented nowhere? (LogiLedSetLightingForKeyWithScanCode, LogiLedSetLightingForKeyWithHidCode, LogiLedSetLightingForKeyWithQuartzCode)

OpenRGB seems to have the codes in their matrix: https://gitlab.com/CalcProgrammer1/OpenRGB/-/blob/master/Controllers/LogitechController/RGBController_LogitechG915.cpp

Maybe it's possible to just send the correct media key scan code listed at the end of this file: https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2

I also tried to contact Logitech Dev-Support and asked for an example. Let's see if they even answer.

diogotr7 commented 1 year ago

I wasted far too much time trying to get it to work, I tried all those methods you suggested with every keycode I could.

If somehow I'm wrong and logitech dev support points you in the right direction then we can look into the issue.

RobertBeekman commented 1 year ago

I'm going to merge this one as-is without making the changes to layout selection. I don't really want to mess with that right now since it could potentially break other people's layouts.

When the workshop is ready file-based layouts will mostly become obsolete anyway (although they'll stay supported)

Thanks!

motabass commented 1 year ago

Thank you.

@diogotr7 I see. You already went through the pain. I will let you know if Logitech writes back.