Coder Social home page Coder Social logo

matmoul / g810-led Goto Github PK

View Code? Open in Web Editor NEW
1.4K 50.0 180.0 908 KB

Linux led controller for Logitech G213, G410, G413, G512, G513, G610, G810, g815, G910 and GPRO Keyboards

License: GNU General Public License v3.0

Makefile 3.87% C++ 91.23% Shell 2.57% Python 2.33%
g410 g610 logitech logitech-gaming g810 g910 g213 gpro g413 g512

g810-led's Introduction

g810-led

Linux led controller for Logitech G213, G410, G413, G512, G513, G610, G810, G815, G910 and GPRO Keyboards.

Compatible keyboards :

  • G213 Prodigy
  • G410 Atlas Spectrum
  • G413 Carbon
  • G512 Carbon
  • G513 Carbon
  • G610 Orion Brown
  • G610 Orion Red
  • G810 Orion Spectrum
  • G815 LIGHTSYNC
  • G910 Orion Spark
  • G910 Orion Spectrum
  • GPRO

Contribute and evolution :

Install :

Profiles :

You can load predefined configurations on startup!

Help :

g213-led --help
g410-led --help
g413-led --help
g512-led --help
g513-led --help
g610-led --help
g810-led --help
g815-led --help
g910-led --help
gpro-led --help

g810-led --help-keys
g810-led --help-effects
g810-led --help-samples

Samples :

g810-led -p /etc/g810-led/profile # Load a profile
g810-led -k logo ff0000 # Set color of a key
g810-led -a 00ff00 # Set color of all keys
g810-led -g fkeys ff00ff # Set color of a group of keys
g810-led -s color # Set keyboard power on effect
g810-led -fx color keys 00ff00 # Set fixed color effect
g810-led -fx breathing logo 00ff00 0a # Set breathing effect
g810-led -fx cycle all 0a # Set color cycle effect
g810-led -fx hwave keys 0a # Set horizontal wave effect
g810-led -fx vwave keys 0a # Set vertical wave effect
g810-led -fx cwave keys 0a # Set center wave effect

Samples with no commit :

g810-led -an 000000 # Set color of all key with no action
g810-led -gn modifiers ff0000 # Set color of a group with no action
g810-led -kn w ff0000 # Set color of a key with no action
g810-led -kn a ff0000 # Set color of a key with no action
g810-led -kn s ff0000 # Set color of a key with no action
g810-led -kn d ff0000 # Set color of a key with no action
g810-led -c # Commit all changes

Samples for G610 :

g610-led -a 60 # Set intensity of all keys
g610-led -k logo ff # Set intensity of a key
g610-led -g fkeys aa # Set intensity of a group of keys

Samples for G213 :

g213-led -a 00ff00 # Set all keys green
g213-led -r 1 ff0000 # Set region 1 red

Samples with pipe (for effects) :

g810-led -pp < profilefile # Load a profile
echo -e "k w ff0000\nk a ff0000\nk s ff0000\nk d ff0000\nc" | g810-led -pp # Set multiple keys

Testing unsupported keyboards :

Start by retrieving the VendorID and the ProductID of your keyboard using lsusb.
lsusb
Sample return :
Bus 001 Device 001: ID 046d:c331 Logitech, Inc.
In this sample VendorID is 046d and ProductID is c331. Now test your keyboard with all supported protocol (for 2019 keyboard start with -tuk 4):
g810-led -dv 046d -dp c331 -tuk 1 -a 000000
If your keyboard set all key to off you have found the protocol (1), if not continue.
g810-led -dv 046d -dp c331 -tuk 2 -a 000000
If your keyboard set all key to off you have found the protocol (2), if not continue.
g810-led -dv 046d -dp c331 -tuk 3 -a 000000
If your keyboard set all key to off you have found the protocol (2), if not continue.
g810-led -dv 046d -dp c331 -tuk 4 -a 000000
If your keyboard set all key to off you have found the protocol (3), if not, need new dump.

Building and linking against the libg810-led library :

Include in implementing source files.

#include <g810-led/Keyboard.h>

To link, simply provide -lg810-led to the build flags.

To build the g810-led application as a dynamically-linked variant, run the target:
make bin-linked

Dumps :

Dumps of keyboards are now stored in a separate project to preserve a small download size of this project. You can find them here : https://github.com/MatMoul/g810-led-resources

g810-led's People

Contributors

barul42 avatar carlba avatar cornernote avatar creimer avatar da2x avatar dioni21 avatar dkolosa avatar francoisopenroad avatar jdagerbo avatar kenthor avatar krutonium avatar lanodan avatar larsnaesbye avatar linusmartensson avatar lkiesow avatar lleukkun avatar lynix avatar matmoul avatar matthunz avatar mohamadsaada avatar noisycat avatar panticz avatar pearsonk avatar pfsmorigo avatar sebatrenault avatar sebschlicht avatar simon-wh avatar skitt avatar sydneybrokeit avatar vicalca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

g810-led's Issues

Does not set all keys at once

When using -an FFFFFF, some keys will stay the previous color; running the command multiple times will solve the problem, and it always happens in a VERY predictable way.

Using US layout keyboard on Arch.

Wrong color on single keys when setting color for key group

First, thanks a lot for providing a tool for Linux support for this keyboard, greatly appreciated!

When using the -g command to set the color for a group of keys sometimes the wrong color is set on random single keys.

The more keys you set within a group the more keys will have the wrong color. The effect gets worse on a faster computer (laptop vs. fast desktop computer) and seems to increase with the number of keys set in one operation, so it might be a timing issue. Also, using the -p command to set a profile for all keys, I end up with a couple of wrong key colors.

Repeating the command helps for single groups, so after a couple of attempts, the colors are correct. However, this work doesn't help when setting a complete profile with -p.

Command line option for Logitech G410

I 'm using g810-led with my Logitech G410 which is basically a smaller version of the G810 with the same RGB Romer-G keys. It was rather easy to get the program working - I just changed the USB product ID (PID) from 331 to 330. This patch works in the C and the Python version of the program.

Perhaps the G410 could be officially supported? Via a command line option to select either G810 or the G410?

Supporting local characters

I'd like to be able to set the color of the keys of my Nordic keyboard (I'm Danish, so I use 'æ', 'ø', and 'å' a lot. However, I have to specify other keynames to set those keys.

My wish is to be able to specify, e.g. g810-led -k æ ff0000

I'd like to help by writing and testing the actual code, but thought it might be good to discuss how to generalise this best. Can we get the key mapping for a character from the driver, for example?

Expose underlying interfaces as a shared library

It would be useful for the interfaces exposed by Keyboard.cpp to be exposed as a shared object library so that other applications could link against the underlying implementations without the need to create the driver process (g*10-led). The segmentation between the driving application (main.cpp/helpers) and underlying implementation seems fairly conducive to creating a library.

New hidapi version

I just added support to hidapi...
And setting all keys is too speed...
time g810-led -a ff0000
real 0m0.019s

Return on this version is welcome :
(Look INSTALL.md file for installing dependencies)
git clone https://github.com/matmoul/g810-led.git
cd g810-led
make
sudo make install

Asterisk symbol not working on Nordic keyboards

When using single key operations (-k) on my g810 i can set all other keys, except for the asterisk(*) key on my keyboard. When setting the locale to English, the key becomes backslash(\). When using the key group, the color changes correctly. I have tried g810-led -k backslash ff00ff , which did not change it.
I am using the (0x46d, 0xc337) model g810.
I have added images of my keyboard in english locale, and Nordic(Danish) locale.
The reported keycode is 43 decimal.
image

image

Group: gkeys

According to the use page of your wiki, there is no group for the G-keys.
However, on spec I used the group value gkeys analogous to fkeys to set the colors on my G910 - which surprisingly worked.
It may be just a typo and keys should be gkeys but that group should definitely be mentioned, as your software supports it.

G610

Hello,

I have a G610 and the native effects does not work properly.
For instance the cycle effect turn the light on following a gradient but there is not time evolution.
How can I contribute to fix this bug ?

Also on windows it is possible to have an effect where the keys light turn on for a small time after pressing them. Is it possible to implement this effect ?

If I well understand, these native effects are implemented in the hardware and we can run them by sending a simple message via USB. Is this effect "light on when pressed" also native ?

Also is there any memory into the keyboard to remember the configuration ?

Y and Z keys crossed with QWERTY keyboard ?

With my QWERTZ keyboard, in the code, the y and z keys don't follow each other values of the constants.
Can anyone confirm that the y and z keys are not crossed with a QWERTY keyboard ?
Test with ; g810-led -k z 00ff00

Keys with no color after script / profile

When I run a g810-led -pp < profilefile some random keys are not colored. I have to repeat once, sometimes twice before all keys are as I want them to. On the fly it's not a big issue, but when I try to color the keys via rc.local or similar it's an issue.

Need data dumps for effects

Task list for data dumps required for full featured deployment

  • Breathing
    • solved color
    • solved speed
      • speed - high
      • speed - mid
      • speed - low
  • Fixed Color
    • solved color
  • Color Cycle
    • speed
      • speed - high
      • speed - mid
      • speed - low
  • Color Wave
    • direction
      • Horizontal
      • Vertical
      • Center Out
    • speed

My g810 has a different product ID.

Took me a while to figure out why this wasn't working. My g810 is:

Bus 002 Device 019: ID 046d:c337 Logitech, Inc.

The 0x046d for vendor ID is correct, but my product ID is 0xc337. Seems like there's multiple types of g810 out there and this should probably try connecting to all known g810 pids.

Installation Failure

Installation documentation is a bit sparse. I can't seem to get it to work on my machine.
libusb, g++ are installed, and the g810 'makes' properly.. however the keyboard does not leave the default rainbow effect.

Crashes G910 firmware

The last good commit is 2795151. Everything after this commit crashes the G910 firmware and to make it work again with an older version I have to unplug and replug my keyboard.

`-g keys` has inconsistent behavior

I loaded this sample profile and noticed that my U key was, for some reason, orange. Looking at the profile, I didn't see any references to specific keys, or even that color. So I set all the keys to the same color and tried running each line one by one. When I got to g810-led -g keys 009696, I noticed my 3 key had turned the same shade of orange. Running the command a few times changed the colors of other random keys, either turning the LED's off, or making them that orange color.

To reproduce: Simply run g810-led -g keys 009696, and look for any keys that aren't the color they should be. Try running it a few more times and watching for changes. Or you can even do while true; do g810-led -g keys 009696; done and watch random keys flicker on and off.

Wrong executable path in systemd service file

In the set profile on boot wiki page when referring to the executable in the Service section it is assumed to be located in /bin:

[Service]
ExecStart=/bin/g810-led -p /etc/g810-led/profile

When the user has followed the installation instructions that are currently present in the wiki, the executable will be located in /usr/bin. Thus the section should be changed to:

[Service]
ExecStart=/usr/bin/g810-led -p /etc/g810-led/profile

List of keys in --help

I had to examine source code to determine that I needed to type openbracket and closebracket to get the [ and ] keys to change, since [ and ] are not accepted as values. It would be very helpful to list the valid key identifiers in --help.

Reduce needed sleep time for G910

Follow-up issue for #63

Things I didn't test:
There might be a connection between what's been sent to the keyboard:

  • A commit might take the full 1.1ms or depending on how much is cached to commit.
  • Pure RGB commands might not need this sleep at all.

But for this I need your help. Where's the best place to try different usleep times for different commands. Especially the difference between the commit command an non commit commands?

Are you interested in my python based test script?

Question: support select keyboard

Hi MatMoul! I want to connect 2 keyboards and select the keyboard I want to write the effect/keycolor to. Is this possible or can u give me a hint how to do this?

G410 Logo

In the help-keys of the G410, they talk of Logo. And that it need confirmation. I have the G410, and there is no logo that have a light. Even the logitech soft, you can't do anything with the logo.
P.S. not sure if an issue is the right place to ask to remove this, but I didn't find a better place.

Error loading profile

Hi, i'm happy that somebody add such support of Logitech keyboards to linux.
But i have problem with profile.
I extract my profile from windows into xml file and place it in /etc/g810/ filename is "profile".
Then i run
sudo g810-led -p /etc/g810/profile
And got error on every line of file:

Error on line 1 : <?xml version="1.0" encoding="utf-8"?>
Error on line 2 : <profiles xmlns="http://www.logitech.com/Cassandra/2010.7/Profile">
...

What is wrong? Or may be I'm not understand something?

Basic G610 support

Hey, just found your code and was so happy, since it's a stepping stone on getting it done for G610.

I'm willing to provide you with any kind of dumps, testing etc. if you just tell me what you need. I am also willing to look into it myself, if you maybe can give me a pointer as to which dumps to generate (which I then can analyze). I'm trying to at least set the mode on it, since it starts out with this annoying wave that I don't want to manually change from (brightness key + 0) every time I start the computer.

As it is right now, I don't think the program is detecting the keyboard at all, no errors and no output. I'm guessing there's a minor difference in some ID somewhere. Let me know what you think.

Question: Timeline for libusb-1 deprecation

I'm working on some code to address issue #47 and support for specifying device by product ID as well as serial (and fix a current wchar_t logic error). This will allow running commands and automate testing of multiple keyboards without having to plug/unplug devices.

I have this working with the hidapi-hidraw portion of the code and was wondering what the timeline is for dropping the libusb-1 portion. If it is to be dropped soon, I'd rather not invest time in writing/testing that particular interface.

Does this work on Windows/Cygwin/MinGW?

Can this be made to work in Windows/Cygwin/MinGW? It would be very handy to replace the default software that logitech bundles. I am willing to offer any help that is needed.

I think if the PyUSB library can be made to work with the windows system, rest should work out easily.

Magic Numbers

Magic Numbers (e.g. productIDs, Keys, etc) probably need to go into enumerated constants before we start trying to generalize layouts.

Segregate installed components

Currently the install target provides the g810-led binary with symlinks, systemd services, and samples. Makefile can be segregated to allow for more fine-grained control over what gets installed, to allow packaging things separately. Furthermore, there is inconsistent use of DESTDIR that can be applied more completely to allow staging all appropriate files into distributable packages.

Next project name

I have maked this project for the logitech G810 keyboard but now, it's compatible with G410, G610 and G910...

It becomes interesting to think if the project name should become more generic.

As examples:
logi-led
logi-rgb
other ?

what do you think ?

G403 Wireless mouse support

Hi!

I now own a G403 wireless mouse and would like to control its LEDs. This project is the closest software I could find to this goal, but it only support keyboards. Hopefully, the protocol is close enough.

So this is more of a question of how to add support for a new device to g810-led. What is the process? Are there any specs available from Logitech? Or should I find a Windows box, install original Logitech software, then start sniffing USB or so, trying to guess what the protocol is?

Key names for different keyboards are inconsistent

On my keyboard, I found the following:

- changes the / key.
? changes the - key
unknown changes the \ key
' changes nothing
à changes the ' key
§ changes the ~ key
tidle [misspelled, see my other issue] changes the = key

My guess is that different pids (see my other other issue) refer to different keyboard layouts, and you could probably use the pid that successfully connected to determine which named keys should refer to which key IDs. But since I only have one keyboard, I can't verify that.

My keyboard is US QWERTY layout for the record.

Effects on G410

Here is my test of the effects on the G410. I use the sample provided in /etc/g810-led/samples/.

all_blue_fxl_breathing_red: Does the fx only on the logo. So it don't work on the G410 (no logo to light).
fx_breathing_red: Work perfectly
fx_color_green: All keys became green. And then nothing change. I don't understand this fx. What is it supposed to do?
fx_cwave: Works perfectly. The wave start around the 'uijk' key.
fx_cycle: Works perfectly.
fx_hwave: Works perfectly.
fx_vwave: Works perfectly.

If you want video to see real result, or other commands to test, just ask.

Note: In the --help-effects a little information on each effects would be good.

G213 Support

The Logitech G213 is a new LED keyboard that supports many of the core features, with the exception of it having 5 LED regions as opposed to the per-key-LED structure of the other currently-supported keyboards.

Some preliminary work necessary to investigate feasibility:
https://github.com/pearsonk/g810-led/tree/G213-develop
Only took a swing at setAllKeys for now, but split across 5 calls to a new setRegion function.

g610 brown help required

When I tried to set up fx effect using the command:
g610-led -fx hwave keys ff

The entire keyboard became dark. Thanks in advance for help :)

Install Error

Hi, after "sudo make install" displays:

cp: αδυναμία αντικατάστασης του καταλόγου '/usr/bin/g810-led' με μη κατάλογο
makefile:29: recipe for target 'setup' failed
make: *** [setup] Error 1

Script Mode

I think I've found what makes this soft so slow ...
It's to detach and reattach the keyboard to the kernel.

I would need some feedback on the new branch scriptmode.

By using it for simple profile. To see if no keys are missed.

And for those who create effects, by testing the new function before using a script:
g810-led -script-on

For scripts, don't forget that there is the possibility to send several commands with the -pp parameter:
echo -e "k w ff0000\nk a ff0000\nk s ff0000\nk d ff0000\nc" | g810-led -pp

To install :
git clone https://github.com/MatMoul/g810-led.git
cd g810-led
git checkout scriptmode
make
sudo make install

Sample :
time g810-led -a ff0000
real 0m0.154s

g810-led -script-on
time g810-led -a ff0000
real 0m0.047s

G910 support

Hi is it possible to get this to work with the G910?

Logitech G Pro keyboard support

The title is self-explanatory.

Logitech released this keyboard in March, and it is pretty much a TKL G810.

Any plans to update the g810-led with G Pro support?

Thanks for your wonderful, groundbreaking work with the supported keyboards, I never thought I would find something like this!

g610 orion brown help needed

Hi,

first of really thank you for this project.
Unfortunately it seems I cannot set anything on my keyboard. When I installed it all my keys and numerics went to black and everything else is started to glow white.

These are the commands I tried:
g610-led -a ffffff
g610-led -g keys, ffffff

Handling command line inputs with ASCII values > 128

Need to decide on how we're going to do that if we want people to be able to use even the unsigned char set, like æ as @larsnaesbye pointed out. I don't have much experience with unsigned char (or unicode) on the command line as arguments for C programs, but being able to handle it at all is a prereq of handling local character sets.

Ability to set speed of effect

I like the rainbow effect, but I find its default speed to be distracting. With the windows driver I can set it to be very slow. but I can't do that with this as far as I can tell. Would be great to be able to set effect speed.

Logitech (TM) etc.

We probably need to make sure and add that we have no connection with Logitech and that all their symbols and trademarks remain their own. I figure as long as we're respectful they'll leave us alone, as their gaming software is technically complicated enough that I now understand why they didn't release a *nix version of it.

Built-in effects on g910

On the g910 orion spectrum model it is necessary to change data[2] from 0x0d to 0x10 in each of the Keyboard::setFX functions. With this change in place all of the new patterns now work on this model. I'm not sure that 'speed' does anything though.

Key Press / Fade

Hello! Just wanted to say thank you so much for uploading this, very simple easy to use, I love it. Was playing around though and found im having a hard time getting a key press then fade back to original color effect. Logitec offers: Key Press — The keys change color when you press them. Use the color selection wheel to choose a preset color or customize your own. You can also set a background color for the entire keyboard. Use the slider to set the rate at which the color fades back to the background color.

I was curious If you had any Ideas on how to make this work, also I found I cannot find a way to set a color to my numberpad_enter key, I've tried g810-led -k num_enter 00ffff and g810-led -k enter 00ffff but neither seem to work for me.

edit I read something in a earlier closed post about the key press needing the gaming software to work? were you and noisycat suggesting It could work within a vm if I run the software in the vm>?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.