Controls the RGB on the keyboard for the Legion 5 Pro from Lenovo. Mostly used for learning a bit of rust.

Overview

L5P Keyboard RGB Control Program

A fun little experiment. Probably contains bugs.

⚠️ Use at your own risk, the developer is not responsible for any damages that may arise as a result of using this program.

Compatibility

This program has been tested to work on the 4 zone keyboard of the Legion 5 Pro 2021. It should alledgedly work on the Legion 5 Gen 6 2021 too, though I'd need to test it with an user who has one.

"How about X model"

  • Legion 7(i): Won't work, the backlight on these is per-key and uses a different way of communicating.
  • Any variant with a white backlight: Havent figured out how to talk to this one yet, but given the limited number of states (off, low, high) there's not many effects I'd be able to add anyways.

Download

Builds will be periodically uploaded to the releases tab.

You may also download precompiled versions from here (requires github account) by clicking the latest entry with a and going under the "artifacts" section.

Available effects

All stock effects: Static, Breath, Smooth, LeftWave, RightWave.

  • Lightning: Adds a little spark.
  • AmbientLight: Reacts to content on your screen.
  • Smooth(Left/Right)Wave: An implementation of the classic wave effect.
  • (Left/Right)Swipe: Transitions the selected colors from side to side, useful for custom waves.

Crashes, freezes, errrors, etc

I cannot guarantee this solution will work for anyone but myself. That being said feel free to open an issue if you encounter any of these problems on the issues tab.


Thanks to legendk95#0574 (272711294338072577) over at discord for initially reverse engineering the way to talk to the keyboard.

Comments
  • Error: Couldn't find device

    Error: Couldn't find device

    Hey there. I have a Lenovo Legion 5 (not Pro) and I've tried running the executable and get this error:

    thread 'main' panicked at 'Error: Couldn't find device', src/main.rs:8:21 note: run withRUST_BACKTRACE=1environment variable to display a backtrace

    enhancement compatibility 
    opened by lucidtyper 13
  • Unable to compile with cargo build

    Unable to compile with cargo build

    When doing cargo build it complains about

    "error: failed to run custom build command for `scrap v0.5.0"

    Here is the full log

    #RUST_BACKTRACE=full cargo build

    Compiling fltk-sys v1.1.16 Compiling scrap v0.5.0 (/media/X/t/L5P-Keyboard-RGB-0.7.0/libs/scrap) error: failed to run custom build command for scrap v0.5.0 (/media/X/t/L5P-Keyboard-RGB-0.7.0/libs/scrap)

    Caused by: process didn't exit successfully: /media/X/t/L5P-Keyboard-RGB-0.7.0/target/debug/build/scrap-e71d258a2e2dc590/build-script-build (exit code: 101) --- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: NotPresent', libs/scrap/build.rs:7:63 stack backtrace: 0: 0x5566196b6781 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc07c9cd6473c184f 1: 0x5566196e15ec - core::fmt::write::hd5abae825e92a210 2: 0x5566196c2187 - std::io::Write::write_fmt::h3f63b42f66032676 3: 0x5566196bdce2 - std::panicking::default_hook::{{closure}}::h9451e4f30330b478 4: 0x5566196bd9ab - std::panicking::default_hook::hccf5200ac295eadd 5: 0x5566196be31a - std::panicking::rust_panic_with_hook::h8d53767150680421 6: 0x5566196bdefb - rust_begin_unwind 7: 0x5566196ee281 - core::panicking::panic_fmt::h59908d1ffbada4a3 8: 0x5566196ee313 - core::result::unwrap_failed::h90156c5ceff9b971 9: 0x5566190a2eb7 - core::result::Result<T,E>::unwrap::h3a90bebaed428072 at /tmp/rustc-1.46.0-src/src/libcore/result.rs:1005 10: 0x55661909d95d - build_script_build::find_package::hd12a8f01cc37db73 at libs/scrap/build.rs:7 11: 0x55661909fa5b - build_script_build::main::h32c56f700991bd73 at libs/scrap/build.rs:86 12: 0x5566190a2b5b - std::rt::lang_start::{{closure}}::h2d70ff4dcd9d85d6 at /tmp/rustc-1.46.0-src/src/libstd/rt.rs:67 13: 0x5566196bbb45 - std::rt::lang_start_internal::h50104ee6cf97d478 14: 0x5566190a2b34 - std::rt::lang_start::h572ea5d604fdc3d4 at /tmp/rustc-1.46.0-src/src/libstd/rt.rs:67 15: 0x55661909fbda - main 16: 0x7f58cf3697d0 - __libc_start_main 17: 0x55661909d379 - _start at ../sysdeps/x86_64/start.S:108 18: 0x0 - warning: build failed, waiting for other jobs to finish... error: build failed

    compatibility 
    opened by gnomiik 10
  • Legion 5 Pro after opening nothing

    Legion 5 Pro after opening nothing

    Hello

    Legion 5 Pro: 16ACH6H 4 zone RGB keyboard Windows 11.

    I wanted to open the program but literally nothing happens. (even in compability mode) Trying to open the latest version and 0.7.0 do the same thing.

    I try to open it and maybe it instantly crashes but I see that nothing is happening. It doesn't give any errors, just completely nothing.

    Also installed Rust but it didn't help.

    bug wontfix 
    opened by r0836332 9
  • Lenovo Legion 5 Pro Gen 7 AMD keyboard not recognized

    Lenovo Legion 5 Pro Gen 7 AMD keyboard not recognized

    When I open the app is says, "A valid keyboard model was not found. It may be due to a hardware error."

    Lenovo Legion 5 Pro Gen 7 AMD Model: 16ARH7H Type Model: 82RG001MUS Win 11

    opened by GustavoCab2 7
  • Suggestion: Start program while being minimized to system tray

    Suggestion: Start program while being minimized to system tray

    As shown in the title, a toggle which can start the application but by putting it on the system tray so it can be opened from there, ideal for startup when booting up the machine just not to make the setting console to stay there unless i click the red X or by minimizing it, it can make things cleaner

    feature request 
    opened by Rodrxx 6
  • Ambient and Temperature modes not Working on Linux

    Ambient and Temperature modes not Working on Linux

    Using Kubuntu with Kernel 5.13.0-25-generic and Plasma version 5.23.5, when using these two modes nothing happens. Kindly look into this issue.

    By the way, awesome app my dude

    opened by TheHawaiianKoala 6
  • Initiating the tool with windows through task scheduler breaks function keys apparently

    Initiating the tool with windows through task scheduler breaks function keys apparently

    I just want to leave a experience with the app, maybe is just my fault, i wanted the app to run exactly at the time the machine turn on so i dont have to manually open it everytime i log in, so i created a task in task scheduler to open the app as soon as the machine boots up, before i log in (so i had to type administrator password to create the task).

    Next time my machine booted up, apparently the function keys like brightness control, airplane mode, microphone, touchpad toggle and lenovo special key stopped working, also the status LED for the num lock key got stuck and it couldnt turn it off even if the num pad wasnt active, same goes for the caps lock, which was the opposite, it couldnt turn on even if the caps lock was active.

    Volume keys, num lock, caps lock worked fine, and the Fn Lock in Esc key worked only if i turn it on through software, and i can even control the normal rgb as usual through the app and lenovo vantage software, the only thing broken was the rest of the Fn Keys and the Status LED on some.

    Maybe it was just my bad but the only way to solve this problem, i had to do a factory reset, contacted lenovo support and they brought me a tool to reinstall windows from scratch, so the problem was solved there, a little advice to someone who could do the same, and this thing happened, so if anyone with their 5 pro could try this (if the issue exists you may have to factory reset the laptop using the lenovo recovery key to fix it) and confirm this issue since i dont want to factory reset my 5 pro again, so the dev can make a failsafe in this regard if that was the case or not because im dumb enough to do that kind of stuff

    opened by Rodrxx 6
  • Won't run on Archcraft Linux

    Won't run on Archcraft Linux

    Problem Every time I try to run this as a non-root userI get the following error:

    floating point exception (core dumped)

    I have added the needed udev rule and reloaded the rules, so I'm not sure why it won't launch. However, it does work when I run it as root. Although that gives me this error:

    pango_font_description_set_absolute_size: assertion 'desc != NULL' failed

    Notes I checked to see if pango was installed, and version 1.50.7.1 is present

    I didn't build from source, instead I used the zip archive

    I'm not sure what to do at this point besides trying to build from source and seeing if that works. Any other suggestions?

    opened by shadjo1 5
  • Asking For launch

    Asking For launch

    Question?

    The application is compiled and it's a success.. The main Question is how to run the application for the first time.?

    System Info:

    My current device is Lenovo Legion 7 Slim. Specification are:

    • 16GB Ram
    • 512 SSD
    • Pure Arch Linux
    • AMD Ryzen 7 5800H
    • Nvidia RTX 3060
    opened by rafay99-epic 4
  • Task closes itself after waking up the machine from sleep

    Task closes itself after waking up the machine from sleep

    Im just seing that the program closes itself after one or two suspend action of windows, dont know what is happening but everytime i wake up my laptop from sleep, the program quits itself and stop running, having to open it again to summon the custom lightning

    opened by Rodrxx 4
  • AmbientLight effect sensitivity/speed adjustment parameter

    AmbientLight effect sensitivity/speed adjustment parameter

    Hi. Props to you for putting this program together, it works fine on my Legion 5 (15ARH05H).

    It's working fine overall but, at times the program is reportedly using 8%+ CPU including while not much/anything is going on the screen.

    So, to minimize the load on the CPU I think it's be nice to have a parameter to set the rate of the screen reading so that we can have it respond quick enough to our preferences while also saving some system resources. I know, these are beasty machines and all but for one I'd be fine with even half the detection rate/reaction time knowing that the program isn't doing that at times 8%+ processing anymore. :D

    opened by ccelik97 3
  • [Question] Do you accept pull requests for new effects?

    [Question] Do you accept pull requests for new effects?

    Hi again and thanks for implementing an user-adjustable FPS limit for the AmbientLight effect. With that provided I managed to make an altered version of it that matches my preferences more closely.

    Do you accept pull requests for new effect profiles here? And if so how should be the code of the new effects formatted?

    opened by ccelik97 3
  • Console window appearing everytime the app gets opened

    Console window appearing everytime the app gets opened

    Since last version v18 everytime the pc boots up and opens the RGB app, now there is a console window that also opens with it, i dont know if was the updated code of the app that causes this, but in the console window i cant type anything, is just a giant black box that doesnt do anything and i can close it perfectly, tried finding solutions from my end if it was something that windows updated and being the reason why the console window is appearing, but nothing so i decided to post this "issue" here.

    opened by Rodrxx 12
  • Can only modify one out of four presets

    Can only modify one out of four presets

    When running linux and using this tool, I can only modify one preset, the other 3 remain as default: pulse, wave and fade. On windows, upon setting it with the proprietary Lenovo software, it loads them up upon booting.

    Is this limitation caused by proprietary firmware level stuff, reverse engineering difficulties, or what? Would definitely like to help on this matter as it is kinda annoying having some RGB on your face while I switch to my preset at 3 in the morning.

    opened by luisschwab 2
  • Crash when inputting numbers in boxes in GUI mode

    Crash when inputting numbers in boxes in GUI mode

    When inputting numbers into the boxes, this application often crashes in GUI mode. These boxes can also be resized left or right, which is definitely not supposed to happen. Here is the crash log.

    No subcommands found, starting in GUI mode. To view the possible subcommands type "legion-kb-rgb --help".
    The application panicked (crashed).
    Message:  called `Result::unwrap()` on an `Err` value: Unknown("An unknown error occurred!")
    Location: src/gui/app.rs:102
    
      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                    ⋮ 8 frames hidden ⋮                               
       9: legion_kb_rgb::gui::app::App::start_ui::h850c2f7f08740869
          at <unknown source file>:<unknown line>
      10: legion_kb_rgb::cli::try_cli::h269fff4a84552eb4
          at <unknown source file>:<unknown line>
      11: legion_kb_rgb::main::h4795929818dda366
          at <unknown source file>:<unknown line>
      12: std::sys_common::backtrace::__rust_begin_short_backtrace::he9e2516d859af302
          at <unknown source file>:<unknown line>
      13: std::rt::lang_start::{{closure}}::h218a02376d1f626e
          at <unknown source file>:<unknown line>
      14: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h5f1ba3b861cac230
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:280
      15: std::panicking::try::do_call::h4febfdb770eca39d
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492
      16: std::panicking::try::h8b0eac8a7d726dbf
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456
      17: std::panic::catch_unwind::h11b83c489c0d8394
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137
      18: std::rt::lang_start_internal::{{closure}}::h63502d2988634103
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128
      19: std::panicking::try::do_call::h4be475cff12d2aae
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492
      20: std::panicking::try::h1a3b25b8eaf9ba31
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456
      21: std::panic::catch_unwind::h224588ada67b9b0b
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137
      22: std::rt::lang_start_internal::h2807b375c1959759
          at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128
      23: main<unknown>
          at <unknown source file>:<unknown line>
      24: __libc_start_call_main<unknown>
          at <unknown source file>:<unknown line>
      25: __libc_start_main_impl<unknown>
          at <unknown source file>:<unknown line>
      26: _start<unknown>
          at <unknown source file>:<unknown line>
    
    opened by ZechariahB 5
Releases(v0.18.0)
Owner
null
The official Game Engine of the Li Institution - Mostly made in Rust. Still WIP

Nengine The Nengine is an open sourced game engine made by the Li Institution. As of writing this, it is in very early development and is definitely n

Li Institution 1 Aug 28, 2022
Easier joystick, mouse and keyboard input handling in Bevy

ezinput A powerful input-agnostic library targeting complete support to axis and button handling for the Bevy game engine. Table of contents About Bra

Pedro Henrique 31 Dec 20, 2022
A simple example showcasing how to use Bevy to display a square with acceleration (controllable with your keyboard) that wraps around the screen!

Bevy Wrapping Square example A simple example showcasing how to use Bevy to display a square with acceleration (controllable with your keyboard) that

Luciano Mammino 3 Oct 23, 2022
Turn your keyboard into a typewriter! 📇

Turn your keyboard into a typewriter! ?? daktilo-demo.mp4 daktilo ("typewriter" in Turkish, pronounced "duck-til-oh", derived from the Ancient Greek w

Orhun Parmaksız 583 Oct 8, 2023
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU

renderling ?? This library is a collection of WGPU render pipelines. Shaders are written in GLSL. shaderc is used to compile shaders to SPIR-V. Defini

Schell Carl Scivally 5 Dec 20, 2022
Little 2D physics engine used for my game Crate Before Attack.

Circle2D Circle2D is a little physics library used for my game CrateBeforeAttack. Live demo: https://koalefant.github.io/circle2d/ It is not productio

Evgeny Andreeshchev 24 Jan 14, 2022
Rust-and-opengl-lessons - Collection of example code for learning OpenGL in Rust

rust-and-opengl-lessons Project requires Rust 1.31 Collection of example code for learning OpenGL in Rust 00 - Setup 01 - Window 02 - OpenGL Context 0

Nerijus Arlauskas 348 Dec 11, 2022
🦀 my exploration and learning journey with Rust

?? Rust Tutorials Welcome to a repository of my exploration of Rust, using the "The Rust Programming Language" tutorial book! This repo is partially f

nareh agazaryan 1 Jan 9, 2022
This is the repository with the tutorials of Learning Rust series in @Leticia-maria Youtube channel

Rust Tutorials This repository contains the information of Learning Rust playlist in my youtube channel. Learning Rust(part. 1)! Installation on Ubunt

Letícia Maria Pequeno Madureira 10 May 24, 2022
My first Real-Time 3D Game Engine learning project written in Rust.

EyeEngine-Rust FOA, sry for my poor English. What is Eye Engine? Eye Engine is my first Real-Time 3D Game Engine learning project. There are two editi

F-seeeye 4 Jan 5, 2022
Learning rust with the olc Pixel Game Engine.

olc rust sketches Learning Rust with the olc Pixel Game Engine. This project is based on olcPixelGameEngine-rs, a Rust API by Ivan Sadikov for the olc

Steve Ruiz 10 Oct 24, 2022
Rust-based command-line language-learning game. Uses the Tatoeba database.

minicloze A command-line language learning game using Tatoeba's great database. Accelerate your studies by putting your knowledge to the test in an ad

benman 3 Mar 5, 2023
Simple rust asset handling derive macro for enums, and a proc-macro learning resource!

asset-derive Summary • Todos • Docs Summary Simple Rust asset loading derive macro for Enums, and a resource for learning proc-macros! Please feel fre

Shadorain 5 Feb 9, 2023
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
Rust-raytracer - 🔭 A simple ray tracer in Rust 🦀

rust-raytracer An implementation of a very simple raytracer based on Ray Tracing in One Weekend by Peter Shirley in Rust. I used this project to learn

David Singleton 159 Nov 28, 2022
Simple retro game made using Rust bracket-lib by following "Herbert Wolverson's Hands on Rust" book.

Flappy Dragon Code from This program is a result of a tutorial i followed from Herbert Wolverson's Hands-on Rust Effective Learning through 2D Game De

Praneeth Chinthaka Ranasinghe 1 Feb 7, 2022
A rust chess implementation using a neural network scoring function built on huggingface/candle + rust + wasm

Rusty Chess What is it? Rusty Chess aims to be a high quality embeddable chess engine that runs entirely locally in the browser (no backend required).

Gareth 3 Nov 3, 2023
A Rust wrapper and bindings of Allegro 5 game programming library

RustAllegro A thin Rust wrapper of Allegro 5. Game loop example extern crate allegro; extern crate allegro_font; use allegro::*; use allegro_font::*;

null 80 Dec 31, 2022
High performance Rust ECS library

Legion aims to be a feature rich high performance Entity component system (ECS) library for Rust game projects with minimal boilerplate. Getting Start

Amethyst Engine 1.4k Jan 5, 2023