Skip to content
A Python script to change the key colors on a Logitech G213 Prodigy Gaming Keyboard
Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pcaps initial checkin Oct 8, 2016
G213Colors.py bump version Dec 19, 2018
LICENSE fixed bug with help from derEisele#4 , added user input validation, r… Oct 2, 2017
README.md added more infos why i did it Oct 16, 2019

README.md

G213Colors

A script to change the key colors on a Logitech G213 Prodigy Gaming Keyboard.

Please also check out these awesome forks:

G213Colors GUI - A cool grafical GUI you can use from the main menu

G213Colors GUI + installation script - The GUI plus an easy installation script

Thanks to derEisele and JeroenED for creating this!

What it does

G213Colors lets you set the color(s) and certain effects of the illuminated keys on a G213 keyboard under Linux.

The original Software and Hardware has the following downsides:

  • There is no Linux software
  • The keyboard does not save the last setting, one has to re-set it every bootup / disconnect
  • The keyboard starts up with an annoying color cycle animation
  • The original software is unusable with KVM switches

So i decided to reverse engineer their USB protocol and to write my own script to control the keyboard.

G213Colors was built and tested under Linux for the G213 keyboard specifically, but after some adaptation it could potentially be run under other OS'es and used for other Logitech keyboards as well. Please understand that i do not support any such adaptation, if you want to do it you are on your own.

The "Wave" color effect that is available with the Logitech software could not be replicated since it is completely generated in the software by updating the colors every x ms (In contrast to the other effects which run on the keyboard itself). You could generate this effect with a script, but since G213Colors has to detach the kernel driver from one of the G213's interfaces to send data out the multimedia keys would most likely stop working. Unfortunately this is a side effect of the linux driver structure.

Installation

Either download the G213Colors.py file to a directory of your choosing or clone this project with git.

Prerequisites

  • Python >= 2.4 or 3.x (which is usually already installed)
  • PyUSB (please see their instructions on how to install)
  • RandomColor (pip install randomcolor)

Please ignore the pcap directory, i added the pcap files i used for reverse engineering just in case someone wants to work with them. They can be opened with Wireshark.

Usage

For help on how to use G213Colors call the script without any arguments:

sudo python G213Colors.py

G213Colors needs to be run as root as long as your user doesn't have access privileges for that USB device (How to do this, please use "046d" as idVendor and "c336" as idProduct).

Changelog

Changelog v0.3:

  • Added feature: Assign random colors to keyboard by using -ra or -rs flag

Changelog v0.2:

  • Fixed bug preventing setting all 5 color fields correctly, thanks to @oncecreated for finding this solution!
  • Added propper validation of user inputs
  • Complete refactoring

Changelog v0.1:

  • Initial checkin
You can’t perform that action at this time.