Git Product home page Git Product logo

rgb_keyboard's Introduction

rgb_keyboard

Controls the RGB lighting on some keyboards. Tested on Linux and FreeBSD, should work on other operating systems.

Disclaimer: This software is not supported by the manufacturer of the hardware in any way, and relies completely on information from reverse-engineering. There is no warranty, especially in case of damage to the hardware.

Supported keyboards

USB keyboards with VID 0x0c45, maybe others.

Name PID Tested Uses control transfer mode
Tecware Phantom RGB TKL ANSI and TKL ISO
Glorious GMMK full-size ANSI and TKL ANSI
0x652f Yes No
Ajazz AK33 0x7903 Yes Yes
Redragon K550 Yama 0x5204 Yes Yes
Redragon K556 Devarajas
Redragon K587 PRO Magic Wand
Redragon Mitra RGB
Redragon SURARA K582
Redragon K589 Shrapnel
0x5004 Yes Yes
Redragon K552 Kumara 0x5104 Yes Yes
Warrior Kane TC235 0x8520 No (Yes)

See --control option for details on the control transfer mode.

You can help to expand this list by providing information whether this software works correctly or not.

Known issues that require your help (please open an issue or pull request if you want to contribute):

  • Remapping keys on the Ajazz AK33 and some ISO boards is broken (all keys are shifted around). Remapping works on the Tecware Phantom TKL ISO, but there might be different firmware versions, so be careful when trying this.
  • Setting the USB report/poll rate on the Ajazz AK33 is untested
  • Custom led patterns don't work correctly on the Redragon K550 Yama, K556 Devarajas and K587 PRO Magic Wand.

Installing

  • Clone this repository or download a release
git clone https://github.com/dokutan/rgb_keyboard
cd ./rgb_keyboard
  • Make sure you have libusb installed (on some distros (e.g. Ubuntu) you might need a dev package)

Arch Linux

An AUR package is available.

Linux

  • compile and copy everything to the right place with (not required: replace the 4 with the number of cpu cores you have)
make -j4
sudo make install
  • restart for the udev rule to take effect (without this you probably won't be able to use this softwate without root)

FreeBSD

  • install pkgconf
  • compile with
make CC=clang++ -j4
  • copy rgb_keyboard to some directory in your $PATH, or execute it directly with
./rgb_keyboard
  • Current limitations on FreeBSD:
    • You need root privileges to use the program
    • After the program has finished, the keyboard won't work and needs to be unplugged and plugged back in.

OS X

Compiling and running on OS X is not properly tested or supported because i don't have access to a machine with OS X. However all dependencies are available and compiling with clang should work (more information), your feedback and contributions are welcome.

Usage

rgb_keyboard --help

to see all options

rgb_keyboard --list-keys arg

to see all keynames (arg = led, map, option)

For the gui see the appropriate section below

Profiles

Three individual profiles (1-3) are stored on the keyboard. Examples:

rgb_keyboard --active 2

to change to the second profile.

rgb_keyboard --profile 3 ⟨further options⟩

to apply settings to profile 3. Without this option profile 1 is used.

Examples

rgb_keyboard --brightness 5 --speed 2 --color 00ff00 --leds rain

to set a specific pattern.

rgb_keyboard --custom-pattern example.conf

to set a custom pattern from a file.

rgb_keyboard --keymap example.keymap

to set a custom keymap from a file.

Config files (Key mapping and color)

Take a look at example.conf and example.keymap. Use the --layout option if your keyboard is not an ANSI one, e.g. --layout brazil.

Change custom key colors from the commandline

Similar to the config file, instead of a tab an equal sign and instead of a newline a semicolon is being used. Comments are not allowed. The string must end with a semicolon.

rgb_keyboard --custom-keys "key_name=color;key_name=color;"

--bus and --device options

In case you have multiple keyboards attached or you suspect a keyboard with a different vendor id or product id might be compatible, the keyboard can also be opened by specifying the bus number and device id. These can be found by running lsusb.

rgb_keyboard --bus ⟨bus id⟩ --device ⟨device number⟩ ...

--kernel-driver option

On some systems libusb might no be able to properly detach the kernel driver, and the program will fail to open the keyboard. The --kernel-driver option skips this step and is intended for better compatibility.

--interface0 option

Don't open usb interface 0 on the keyboard. This allows input to happen while settings are applied, and is primarily intended for scripting purposes. Because compatibility is untested, this needs to be specifically enabled with this option.

--control option

This is the replacement for the --ajazzak33 or -A option. This option expects true or false as an argument and toggles the control transfer mode to send data. Normally this shouldn't be required as the program attempts to use the right mode automatically.

GUI

A separate frontend written in Tcl/Tk exists, however not all features are implemented. Running the gui:

chmod +x rgb_keyboard-gui.tcl
./rgb_keyboard-gui.tcl

The gui is not copied to /usr/bin by default, you can do so manually.

TODO

TODO.md

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rgb_keyboard's People

Contributors

dokutan avatar dylanjones 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

rgb_keyboard's Issues

Redragon K552RGB-2

From what I can tell all the features are working with the -A option supplied for this keyboard.

Only two issues I can see is perhaps a color code representation issue. For example FFFFFF is more of a yellow gold rather than a white. Second issue is after a reboot the keyboard turns off after a few seconds of inactivity. I deleted the udev rule, rebooted, and unplugged/replugged the keyboard and it resumed to work as normal. Not sure if this was a bug due to my linux install or the software.

I have not tested key mapping or macros on this keyboard because of the advisories of them being broken.

Is there a testing process that one can go through to check which features the keyboard supports etc.

Thanks

Custom Pattern Documentation

It'd be very helpful to know how to create custom patterns, especially ones like pulse and reactive patterns.

Tecware Phantom RGB TKL- Keymapping doesn't seem to work.

If you accept the risk of permanent damage to the keyboard, type YES and press enter to continue.
Anything else will cancel this process.
At this point the keyboard is completely non-responsive, so I used another keyboard to enter "YES" and hit enter.
After that the keyboard works as normal, without any remapping of the keys.

I'm trying to swap the menu key out for a key in the F13-F24 range (I need a key for push-to-talk that doesn't conflict with anything else, so modifiers are a no-go) so I ran a custom.keymap with this in it:
[keymap]
menu=f13

Not sure if I'm doing something wrong, if it is confused by the second keyboard (issue happened with or without, I just couldn't type anything without it), or if its just not compatible with this model.

Edit:
I tried the config using the case sensitive names originally, and then moved to lowercase to see if it was case-sensitive. The above is the last variation I tried.

Redragon Draconic

I don't know if this is the right place to make this question, but here it goes: There is any plan to add support to Redragon Draconic keyboard ?

ps.: if there isn't the place please close this issue.

Could not detect keyboard - GMMK Pro

Could not detect keyboard, check hardware and permissions.
Try with the --bus and --device options.

I get this even if I use the bus/device args.

lsusb | grep GMMK
Bus 001 Device 035: ID 320f:5044 Glorious GMMK Pro

Ajazz AK33 support

Hello, cool project!

I decided to make an issue because i found that my keyboard (Ajazz AK33, pid 0x7903 ) has a pretty similar (maybe even the same) firmware to the ones you're targeting. i wrote a library + gui to control it that works reasonably well. I will probably grab a couple of the things you're doing that seem to work a little better from very short tests :) .

I was also wondering if you know anything about setting lighting non-permanenly, like the corsair / logitech / razer keyboards allow you to do. The end goal was to add these boards to Aurora for game integration and such but that isnt possible if we're always writing colors to the flash (also, how long does the your program take to set a custom pattern to all the keys at once? I am using windows and haven't had a chance to test it yet)

I will try to get this running on my arch install and will get back to you if it indeed works the same as my tool.

Redragon K552RGB-1 -- Testing

Tested on: Kubuntu 20.10

1. Set active profile 1, 2 or 3

As long as you set profile once and leave it at that, these work fine, great job!

I can set modify them from the original software on Windows and they persist as they are stored on the keyboard.

2. Manual options, e.g.

rgb_keyboard --color 00ff00

It doesn't take any new color.

3. Freeze/Crash

What happens every 3rd or 4th command is it freezes keyboard, which makes the keyboard not work until restart (with only half of the lights on). The last time it also somehow changed the color to green after restart.

Is there a way track any logs to find something out?

Redragon K587 PRO Magic Wand

I don't know if this is the right place to leave this message, but I'm just here to report that this program works on this keyboard. It needs the --ajazzak33 option, though.

I'm running it on Arch Linux. No issues found.

Couldn't execute "rgb_keyboard" (GUI)

couldn't execute "rgb_keyboard": no such file or directory
couldn't execute "rgb_keyboard": no such file or directory
    while executing
"exec rgb_keyboard -h"
    (procedure "checkInstall" line 2)
    invoked from within
"checkInstall"
    (procedure "applyLed" line 12)
    invoked from within
"applyLed "
    invoked from within
".fr.led.top.apply invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 22)
    invoked from within
"tk::ButtonUp .fr.led.top.apply"
    (command bound to event)%     

This happens when I hit "Apply"

Redragon k552-kr kumara not working

Hei

Hei, nice project, Thanks to this I bought a new keyboard :) .
I cant get it work. The keyboard is Redragon k552-kr kumara the lsusb gives me this:

Bus 001 Device 003: ID 258a:002a SINO WEALTH Gaming KB

Bus 001 Device 003: ID 258a:002a SINO WEALTH Gaming KB
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x258a
  idProduct          0x002a
  bcdDevice           90.36
  iManufacturer           1 SINO WEALTH
  iProduct                2 Gaming KB
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x003b
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      67
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     204
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)```

I can give more info if needed. really wold like to get this to work :)


redragon k582 surara not working

Hello it says that this software is compatabile with the redragon surara k582 keyboard but in my case it doesn't detect the hardware.
It keeps giving me can't detect hardware or permission errors even if i I use sudo to try and run the ./rgb_keyboard commands.

I'm using Popos 24 as my linux operating system is that why it isn't being detected ?

using lsusb I get this
Bus 001 Device 002: ID 320f:5000 Evision RGB Keyboard

Custom LED patterns don't work (Redragon K550 Yama, K556 Devarajas and K587 PRO Magic)

Hey, this is a really cool project.

It's somewhat working with my K556 Devarajas (--ajazzak33 required to work), I'm able to set brightness, speed, and colours and trigger the preset patters, but I'm unable to set specific key colours with --custom-keys or set use --custom-pattern.

Using --custom-keys does nothing at all, and using --custom-pattern sets a really weird preset, always the same regardless of what input file I use. For example, using /dev/null as the input file still gives the same result

rgb_keyboard --ajazzak33 --custom-pattern /dev/null

image

Any suggestions for how I could troubleshoot this to get it working?

Redragon K589 Shrapnel compatibility

Tested on US layout variant.

What works:

  • Profile switching, applying to profile
  • Mode (pattern), colour, speed, direction assigning
  • Brightness values correctly identified (0-5)

Unsure:

  • Reactive colour mode variant (how is it supposed to work?)
  • Keymapping and key names; haven't tested it
  • Report rate; unsure what's the default as control transfer mode was enabled by default

What doesn't work:

  • Custom pattern; using the example configuration, many keys get assigned a colour, however big colourless gaps occur and it is clear that the keys are wrong

Problems with Keymapping (ISO layout and Ajazz AK33)

I noticed that, whenever i try to remap a key the keymap ends up remapping my whole keyboard (spacebar becomes "m" and so on). I am using a an ISO 60% GMMK, so im thinking the ISO layout might be the problem.

Add PKGBUILD and publish Arch Linux package?

I want to install rgb_keyboard on Arch Linux without making difficult-to-reverse systemwide changes through sudo make install. I noticed that another of your repos (https://github.com/dokutan/mouse_m908) has a PKGBUILD. Is it possible to adapt it for this repo and publish it to the AUR?

I'm currently building a PKGBUILD for rgb-keyboard-git to install the latest Git commit, unlike the mouse_m908 PKGBUILD which only installs a specific release. As a result, I'm researching pkgver(), and got lost documenting Arch's pkgver comparison algorithm (bad code consisting of layers of cruft and C string manipulation). Finishing this documentation will be slower than adapting a PKGBUILD directly (which I'm not motivated to do).

Redragon K552RGB-1 ABNT2 (Brazilian Layout) Keymapping problem

Problem

Whenever I try to load a color profile the wrong keys are affected. For instance, a change in key "5" would affect the key "2", a change in the key "f" would affect the key "delete" and so on...

Diagnostic

It seems that this keyboard uses a different set of keycodes. I mapped which codes were related to which keys. I also found that there were some keys whose codes were not defined in data.cpp.

Solution

After discovering the codes for all the keys (good old brute force), I changed the data.cpp file and recompiled. It worked perfectly!

data.cpp.gz

GMMK TKL keyboard doesn't work with example commands.

Hey, I wanted to control my RGB with my GMMK TKL keyboard. I can change from the active profiles but doing anything else either completely turns off the RGB on the keyboard or does nothing (running from sudo).

the lsusb output is:
Bus 001 Device 002: ID 0c45:652f Microdia Backlit Gaming Keyboard

If I don't run with sudo I get this:
Could not open keyboard, check hardware and permissions. Try with or without the --kernel-driver option.
(the --kernel-driver flag also does nothing).

Any help would be much appreciated.

Redragon YAMA K550 support

I have a Redragon YAMA K550 keyboard. Unfortunately this doesn't seem to work with it at all.

Is there any testing/debugging I can do, or output I can post, to help get it working? Would be amazing to be able to control the lighting for this kb from Linux.

I'm running Arch if it makes any difference.

Redragon K512 Support

Hi I was wondering if it'll be possible to add support for the Redragon Shiva K512. Upon running rgb_keyboard --list-keys arg it outputs Could not detect keyboard, check hardware and permissions.
This is what I get from lsusb
Bus 003 Device 002: ID 0c45:672e Microdia USB DEVICE
Please let me know if any more info is required

Redragon SURARA K582 support

Hi there,

I have a Redragon SURARA K582 keyboard, and I would like to add support for it. I have set up a VM and wireguard, but the issue is that I have no idea what interactions with the software I should actually capture since "start the capture, trigger some action, stop the capture, save if needed, repeat" is not really that helpful.

Output of lsusb -v -s 001:004 (if needed): https://pastebin.com/8CLK93hH

Can read keyboard but result never changes

The command rgb_keyboard.exe -r --kernel-driver returns:

Active profile: 1

Profile 1:
Led mode: unknown
Direction: right
Color: 11f06f
Brightness: 1735287116
Speed: 1
Report rate: 125 Hz

Profile 2:
Led mode: unknown
Direction: right
Color: fbe96f
Brightness: 50
Speed: 1
Report rate: 125 Hz

Profile 3:
Led mode: horizontal-wave
Direction: right
Color: 10f06f
Brightness: 0
Speed: 3
Report rate: 125 Hz

However this result never changes, even if I manually change the active profile, colour values, etc. For example, after changing the Hz to 250, re-running the command still returns Report rate: 125 Hz.

None of the commands that change the values (such as changing profile, or key colours, etc.) do anything. No console output.

Using a Phantom Tecware TK ISO keyboard.

GMMK long key change times

The GMMK seems to take about 100ms on average to change a key color. Image
I checked the delays like this Image

Is it possible to asynchronously update the keys, or does it just not work like that?

I've tried running the official software for comparison and it seems they managed to get a shorter response time, quarter-half second to change all the keys, while rgb_keyboard takes about 4-5 seconds.

Normally this wouldn't be an issue, but I'm trying to implement custom animation, and the delay limits me to only using a few keys at a time.

I could probably log the packets from the official software if you tell me how. (windows vm)

Note: When I spam color change info at the gmmk, it randomly crashes sometimes (the rgb part reboots)

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.