g810-led
g810-led copied to clipboard
Support for G915
Is there any way to run led controller for g915? "Matching or compatible device not found !"
lukasz@lukasz:~$ lsusb
Bus 001 Device 003: ID 046d:c541 Logitech, Inc.
lukasz@lukasz:~/g810-led$ g810-led -dv 046d -dp c541 -tuk 1 -a 000000
Matching or compatible device not found !
lukasz@lukasz:~/g810-led$ g810-led -dv 046d -dp c541 -tuk 2 -a 000000
Matching or compatible device not found !
lukasz@lukasz:~/g810-led$ g810-led -dv 046d -dp c541 -tuk 3 -a 000000
Matching or compatible device not found !
Hi, g915 aren't supported now, take a look at #188 Try your previous g810-led commands with sudo.
@lukaszuznanski Did you ever get this working? I tried running your commands as sudo with no luck
I'm also trying to make this work on my G915. First I've built it normally and when I run:
sudo g810-led -dv 046d -dp c541 -tuk 1 -a 000000
I got Error: Can not write to hidraw, try with the libusb version
So I've recompiled it with libusb option and now when I run it in the same way as above, I don't get any message, but the return code is 1
and nothing changes on the keyboard. I've also tried with --tuk
values 2 and 3.
After doing some captures I've found out few things. The G915 (or the wireless dongle actually, identified by vid/pid 046d:c541
) has three interfaces in USB descriptor, each containing one HID endpoint:
Interface 0 - Endpoint 0x81 - keyboard input
Interface 1 - Endpoint 0x82 - mouse input (used for multimedia keys)
Interface 2 - Endpoint 0x83 - used for all the G-features (LEDs, configuration etc).
The g810-leds has two modes of operation: hid and libusb.
In libusb case, the problem is visible right away: it assumes the keyboard uses interface 1 and endpoint 0x82 for communication, which is going to fail right away for G915, as it uses interface 2 and endpoint 0x83.
In hid mode, the code opens first hidraw interface it finds with given VID/PID and optional serial number (that's how hid_open
function works; in case of G915, the serial number is unusable, because the dongle doesn't provide one). This fails because it tries to open interface 0 (I'm wondering how this works with other keyboards). For G915, the LedKeyboad::open
should find all matching hid devices and filter by interface number (must be equal to 2), get the device path and use it with hid_open_path
function instead.
LED control
There are at least 2 different commands to set LED colours
- Set up to 4 LEDs, each with its own color:
11 01 0b 1d [AA] [RR] [GG] [BB] [AA] [RR] [GG] [BB] [AA] [RR] [GG] [BB] [AA] [RR] [GG] [BB]
where AA is a led address and following it is the RGB value for that LED. If less than 4 LEDs are being set, then first non-used AA value is set to 0xFF and the rest of the data is filled with 0x00. For example:
- set 4 multimedia keys to color
1400ff
:11 01 0b 1d 9d 14 00 ff 9e 14 00 ff 9b 14 00 ff 9c 14 00 ff
- set backlight level button to color
707070
:11 01 0b 1d 99 70 70 70 ff 00 00 00 00 00 00 00 00 00 00 00
Keyboard responds with
11 01 0b 1d [AA] [AA] [AA] [AA] 00 00 00 00 00 00 00 00 00 00 00 00
where AA are addresses of LEDs being set (positions not used are set to 0xFF).
- Set up to 13 LEDs to the same color:
11 01 0b 6d [RR] [GG] [BB] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA] [AA]
where first 3 bytes are RGB value, followed by 13 LED addresses (if less, then unused positions are set to 0x00).
Keyboard responds with:
11 01 0b 6d [RR] [GG] [BB] [AA] 00 00 00 00 00 00 00 00 00 00 00 00
where RGB is the same value as set in the command and AA is an address of the first LED in the command (I wonder if this is some bug - my keyboard is running on newest firmware).
- Commit color change:
11 01 0b 7d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Keyboard responds with the same data
@yawor did you get this working? The issue is g915 but it closes g815 im confused.
Im still having no luck getting this to work with my G915 Im really tired of the random light show or no lights at all.
@LindaLawton the G915 is identical to G815 regarding the protocol, except for the second byte in the request. This library (and keyleds too) sets this byte to 0xFF, which is fine for wired keyboards, as wired keyboards ignore this value. You can test this by unplugging the wireless receiver for G915 and plugging it with a USB cable to your PC. It'll work exactly like G815.
The problem with wireless keyboard like G915 is that, the second byte is not ignored anymore. It's used to select a device the software is talking to - this is because both the keyboard and the dongle are using Logitech's HID++ protocol. If the second byte is equal to 0xFF, then the software is not talking to the keyboard, but to the dongle - and obviously it doesn't work. The software needs to talk to the keyboard over the wireless link. To do that, the second byte needs to be equal to 0x01 in case of G915 and LightSpeed link.
The LightSpeed dongle is very similar to a Unifying one regarding the HID++ protocol usage. In case of Unifying the second byte does the same exact thing as LightSpeed, but values can be from 0x01 to 0x06 for up to 6 paired devices and 0xFF for the dongle itself. LightSpeed doesn't have pairing ability, so it only supports two values (0x01 for the keyboard and 0xFF for the dongle).
If you look anywhere in the code where the request packet is created, you'll see something like: https://github.com/MatMoul/g810-led/blob/master/src/classes/Keyboard.cpp#L383
data = { 0x11, 0xff, 0x0c, 0x5a };
What I mean is the second value, which is 0xff here and everywhere else.
unplugging the wireless receiver for G915 and plugging it with a USB cable to your PC.
I have it plugged into a dock could this be the issue. Should i try pluging the wire directly into the laptop?
Interesting pulging it directly into the laptop its able to detect the actual name of it now
Bus 001 Device 008: ID 046d:c33e Logitech, Inc. G915 WIRELESS RGB MECHANICAL GAMING KEYBOARD
number is still the same as the number it was pulling off from the dock though
No change still cant access it.
linda@linda-ThinkPad-X1-Extreme-2nd:~$ g815-led -dv 046d -dp c33e -tuk 1 -a 000000 Matching or compatible device not found ! linda@linda-ThinkPad-X1-Extreme-2nd:~$ g815-led -dv 046d -dp c33e -tuk 2 -a 000000 Matching or compatible device not found ! linda@linda-ThinkPad-X1-Extreme-2nd:~$ g815-led -dv 046d -dp c33e -tuk 3 -a 000000 Matching or compatible device not found !
I did try with the g815 commands and they failed. #233
Try changing the USB PID from c33f to c33e everywhere in the code and udev rules to test it as wired.
I only found two places in the code with c33f i changed them as you mentioned.
ran the following again.
linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ make lib LIB=libusb g++ -Dlibusb -Wall -O2 -std=gnu++11 -DVERSION="0.4.0" -fPIC -shared -Wl,-soname,libg810-led.so -o lib/libg810-led.so.0.4.0 src/classes/Keyboard.cpp -lusb-1.0 linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ sudo make install-lib linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ sudo make install-dev
No change.
linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ g815-led -dv 046d -dp c33e -tuk 1 -a 000000 Matching or compatible device not found ! linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ g815-led -dv 046d -dp c33e -tuk 2 -a 000000 Matching or compatible device not found ! linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ g815-led -dv 046d -dp c33e -tuk 3 -a 000000 Matching or compatible device not found ! linda@linda-ThinkPad-X1-Extreme-2nd:~/g915/g810-led$ g815-led -an 000000
question
What is the exact format of the packets we are sending here. Is there any way i can test one of those manually without the library just to test that it even works.
@LindaLawton actually I'm also having issues trying this library to get to work, even though it should with the changes I've described above. It doesn't work with either hidapi or libusb. You can check G915 branch in my fork (https://github.com/yawor/g810-led/tree/g915) to see if it works for you. I had a strange behaviour where the keyboard stopped working at all and I had to turn it off and on using power switch and even use a different keyboard to disable g810-leds to get it working again (this was on libusb).
I've also been playing around with keyleds library and there I was able to get the communication with the keyboard going (over hidapi), but the current version and structure of the library doesn't allow easy implementation of led control with G815/G915. I've been discussing this with the author of keyleds and he has some plans how to make it more flexible, but I think the main issue is the lack of time.
I've also been writing my own tests using hidapi in Python and I've been able to control LEDs on my G915. If I have some time I could post it somewhere for you to play around, but these are just scraps of code put together quickly to test if it works. I've actually started planning my own application in Python for these new keyboards, but it's not on my priority list right now.
Regarding the protocol itself, it's a proprietary Logitech HID++ protocol (version 4.0 or 5.0, I don't remember). There's some documentation laying around the Internet, but most of it is outdated. The protocol is modular - on the hardware (like keyboard, mouse or game controller) there can be multiple services and the device can return IDs of these services and a value which is then used to access their APIs. G815/G915 keyboards actually share most of the services with older keyboards, but LED and effect controls are newer ones.
I have been trying to use the Hub from windows and saving this to the board and thats not working either i keep getting this random cycling though the different color presets.
Its a great board for programming but i really cant take this color changing. My G11 worked fine.
Im not going to be much help with rewriting it in c++ i haven't coded that in fifteen years.
@LindaLawton on the keyboard itself, you can access multiple build-in color presets by pressing backlight button + a number key from the main area (not numpad). The build-ins are under 1-7 and 0 (1-7 are different animations, 0 sets everything to Logitech blue). You can also use backlight button + "+" or "-" keys to increase and decrease animation speeds. There are also two slots (under keys 8 and 9) for user defined color presets. You can store them from the Logitech Hub software. You define it first in the Hub software and then assign the preset to keys 8 or 9 in keyboard settings in the Hub software. Unfortunately the keyboard doesn't remember the last used stored preset, so if you press BL button + 8 for example and then power cycle the keyboard, it'll switch to default one. But there's also a solution for that. You can change build-in settings for M keys. You can do that also from keyboard settings in the Hub software. If I remember correctly, to change them, you need to switch mode of the keyboard by disabling software management in the settings. After that the Hub software gives you the ability to actually store settings on the keyboard itself. When you do that, you can for example assign your stored color preset (for example BL+8) to be a default preset for M1.
backlight button + a number key from the main area (not numpad). The build-ins are under 1-7 and 0 (1-7 are different animations, 0 sets everything to Logitech blue). You can also use backlight button + "+" or "-" keys to increase and decrease animation speeds.
Yes i have that. But the issue is after about 30 seconds - 2 minutes it changes which color setting its using and I get another random one wither it be rainbow effect or water splash effect you never know its totally random.
I am trying to use this as my daily driver for coding the effects are distracting. Its a keyboard i just want one static color. I think we will be bringing this back tonight its to expensive of a keyboard to not be working properly.
My husband says its my fault for not checking if Linux was supported. Its a keyboard why would it need software. You plug them in the turn on and they work. There used to be a standard for peripheral devices.
Well, it's a "gaming" thing 😏. Anyway, this is strange. I don't experience any randomness at all. I've set it up once using Logitech Hub software and I'm using it with my own static backlight preset with my Linux laptop (which is my main machine). I don't have any special software installed, it's just what's set in the HW. Btw did you upgrade the keyboard's firmware? I upgraded mine in Hub when I connected it to a Windows machine for the first time.
Well, it's a "gaming" thing 😉.
I play games to but dont need a light show. Think its an age thing. 😉
Yeah it updated on windows. I over wrote all the M1 -M3 as well as brightness 0 and 9. When it goes into sleep mode now it comes with a light show. Once i touch it it seams to remain static until i stop typing again.
So what your saying is that i should be able to configure it from windows to stop the light show? and it will remain static in Linux?
I was starting to wonder if it was something in Rider or Webstorm that was setting off that extra bit.
I only get the light show when I explicitly select it with backlight button + one of the number keys. Other than that it's always static. It's static when I power it on and when it goes to sleep and wakes up.
Here are my settings: FW: 9.1.35
First I've configured everything with ON-BOARD MEMORY MODE: Off
In my Default profile I've changed only G keys to be empty (I'll maybe change them in the future). My lighting preset is set to Freestyle with my own colors applied to different sections.
Low Battery Mode (Auto): Breathing Red (Logo Only)
Inactivity Lighting: Dim Brightness 50% Start after: 1 minute All lights off after: 5 minutes
Stored Custom Lighting: KEY 8: my preset KEY 9: not set
ON-BOARD MEMORY MODE: On All M slots are set to Default profile with Lighting set to lighting preset stored on KEY 8.
Hello, I tried @yawor branch with G915 support but i have problem with set keys, not working, only all leds are disabled. Have you a small example, that set led of key? For example Python or C++
open usb
write, sets led of key
close
Wireshark usb dump, set logo https://github.com/mienkofax/keyboard/blob/master/g915_logo_set.pcapng
@mienkofax I've tried porting this quickly. It doesn't work for me either. Maybe I've missed some parts of code that also need to be changed. It needs debugging. My fork can be used as a base to work further on this. I don't have access to the keyboard until Tuesday.
For info, I've made a small tool named rawwrite
in led-g810-resources (hidapi only) :
https://github.com/MatMoul/g810-led-resources/tree/master/tools/rawwrite
The tool help a lot for testing :
sudo ./rawwrite vendorID productID rawdata
as ex :
sudo ./rawwrite 046d c541 11ff107c00000000000000000000000000000000
Thank you for info @yawor. @MatMoul this tool is very very helpful. I tried it, but I have a problem writing to the hid hid_write()
-> Error: Can not write to hidraw
I captured communication (https://github.com/mienkofax/keyboard):
- disable all leds
- disable leds on the arrows
- enable leds on the arrows
- enable led for key
w
And I tried run tool with:
./bin/rawwrite 046d c33e 10ff0e3c000000
sleep 0.001
./bin/rawwrite 046d c33e 10ff0e1c000000
sleep 0.001
./bin/rawwrite 046d c33e 10ff142c000000
sleep 0.001
./bin/rawwrite 046d c33e 10ff131c000000
sleep 0.001
./bin/rawwrite 046d c33e 10ff131c000000
But after all commads: Error: Can not write to hidraw
Example: disable all leds
First command from Logitech Ghub, wireshark:
I send: ./bin/rawwrite 046d c33e 10ff0e3c000000
My submitted data, captured request using wireshark
And response:
I'm a beginner in this domain, sorry, but I want to help. I think it will be just a trifle, e.g. padding or maybe typo.
Thank you very much for any help.
Edit: All commands were sent under sudo user.
@mienkofax sudo
?
Or run rawwrite
as root...
And productID seem to be c541 for the G915
@MatMoul, yes I run with sudo and I tried run under sudo user, nothing helped. Data was probably sent, wireshark capture, but maybe message format is not correct.
G915 supports two types of connection:
- usb cabel:
Bus 001 Device 023: ID 046d:c33e Logitech, Inc. G915 WIRELESS RGB MECHANICAL GAMING KEYBOARD
- wireless - Lightspeed:
Bus 001 Device 024: ID 046d:c541 Logitech, Inc. USB Receiver
@mienkofax Thanks for the infos... It seem that the g915 need to be adressed with these 2 differents product ID...
Hi all. Im no coder whatsoever. Im just a linux user (beginner in linux) that want to use this keyboard with my manual colors. The only way is the way described above right? To set it up in windows according to @yawor instruction couple posts up. Did anyone else try this yet? I have the G915 right now but Ive pro-ordered the 915 TKL keyboard that will arrive in a week.. I will try this out then. Right now I have the exact same issue as @LindaLawton . I can press lightkey + 0 and it becomes static for a little while. Then it begins its lightshow again..
I don't know if @LindaLawton managed to duplicate what I did, but I hope that she did. I did my setup with Windows 10 running in VirtualBox - just attached USB receiver to Windows VM and Logitech Hub software detected it without any issues. I'm using G915 with my Linux laptop all the time as my daily driver - no light show at all - only my own static lighting 100% of time. I also have a second PC with Windows where the Hub software is installed. My monitor has a KVM built-in so it switches USB uplink between laptop and PC depending on the video input selected. I've set up a little different color profile in Logitech Hub so I get different colors depending on the system I'm using it with.
I have not been able to get this to work 100%. The closest i came was setting it up in Windows to stay a static color but when it goes into sleep mode i still get a random light show which is slightly annoying but i have learned to live with.
Oh i did find a note where someone said the current version of the Logitech hub is broken it wont write to the hardware (bios / on board memory) memory of the keyboard. You need to go back one version to the previous version then it can write to the board.
None of the commands I have tried with this library have done anything except say its not supported.
This is also my daily driver its a great keyboard being that its wireless being able to keep up with the speed i type when coding all day is impressive.
@LindaLawton either I'm lucky or there's something wrong with your keyboard. What I can confirm is that, when the keyboard goes to sleep, it always goes back to a color schema assigned to active M key. So when I change schema to built-in all blue one by hand and wait for keyboard to go to power save mode and press something, it goes back to my color profile. It uses my saved profile even when I unplug the USB receiver.
BTW I'm not using any software control under Linux. I've set it up once on Windows and stored everything in keyboard's built-in memory. I can create a video and post it somewhere.
@yawor I have also tried to set it up under windows. Any chance you want to take a picture of your settings in the Logitech Hub? I am having a heck of a time to get it to save the the keyboard there are no buttons in the UI, like "SAVE" or "STORE". I'm issues understanding the UI. I even have one key that wont light up under Linux but when I am in windows it has light.
I created a new color scheme Linda 1, set all the color to blue with nothing fancy. I put all the M keys to that and the 9 and 0. I even told it that inactive mode should be as long as i could which was 15 minutes but it seams to start after only five minutes or less. It appears that the issue is wit the inactive mode. I cant find a way to set that to a static color. I can make all the changes i want in the hub but I have only managed to get it to actually save to the keyboard once. I cant find the magic save button.
@LindaLawton sure
Here you first configure your profile and name it (here it's saved under a YAWOR 1
name. Then click on the settings icon (marked green).
On settings page, check your power saving options (marked blue; I don't know if they have any effect when in on-board mode though).
Then assign your saved backlight profile as stored custom lighting to either one of KEY 8 or KEY 9 (yellow box).
Then change mode to on-board mode (green box).
In this mode you can assign a keyboard profile (this is mapping of G keys; green box) and lighting profile (yellow box) to each of the M keys. I don't know if changing keyboard profile is needed, but if you change both, then first set the keyboard profile and then lighting profile, as keyboard profile overwrites lighting profile (at least for me).
Here's the final effect: https://www.youtube.com/watch?v=LsgbMbX0phY The keyboard is not plugged in (the receiver is visible above F keys). As you can see, it uses my profile from the first screenshot right after turning it on.