Coder Social home page Coder Social logo

izurii / lenovo-y720-kb-led-controller Goto Github PK

View Code? Open in Web Editor NEW
50.0 8.0 13.0 838 KB

Controller for the backlight of the Lenovo Legion Y720 keyboard.

License: GNU General Public License v3.0

HTML 4.51% Python 0.62% C 67.30% C++ 5.31% Shell 7.22% Makefile 0.44% TypeScript 14.60%

lenovo-y720-kb-led-controller's Introduction

Lenovo-Y720-KB-Led-Controller

Github releases (by asset) Dependency Status Donate

This software controls the backlight of Lenovo Legion Y720 Keyboard on Linux, as the Lenovo didn't make the drivers/software for Linux.

It works mostly the same as the Lenovo Nerve Center, including the global hotkey of Fn+Space to change between profiles created by the user and the hotkey that is located in the key 7 of the numpad this hotkey opens the software.

Here a screenshot:

Screenshot from 2021-04-09 14-41-02

How to install

Download the latest version here: Releases

You can use the AppImage to run just once the software using this in a terminal with the folder you downloaded the software open

./Lenovo Y720 Keyboard LED Controller-x.AppImage

Or you can install the deb packages using:

sudo dpkg -i y720-kb-led-controller-x.deb

How to grant access to Hidraw and Input device

Hidraw device is used for controlling the leds and the input device is used to detect the hotkey Fn+Space.

Create a file called /etc/udev/rules.d/99-any-name-you-want.rules and write this to the file

SUBSYSTEM=="hidraw", ATTRS{name}=="ITE33D1:00", MODE="0666"
SUBSYSTEM=="input", ATTRS{name}=="*Keyboard*", MODE="0666"

Reboot your PC or use this command to reload and trigger the new udev rules sudo udevadm control --reload-rules && sudo udevadm trigger

DEV

Recommendations

  • VSCode with the extensions listed below
    • Better C++ Syntax
    • Better Shell Syntax
    • C/C++ Extension Pack by Microsoft
    • CodeLLDB (to debug things if you know what you're doing)
    • EditorConfig for VS Code
    • Shell Script Command Completion
    • ShellCheck (if you want to use this extension follow their guide on how to install it)
  • Patience

Requirements to build or start the dev version

  • GCC/G++
  • yarn
  • libevdev (the needed files are already in the ./libs/hotkey/libs folder, but you never know ¯_(ツ)_/¯ )
  • node-gyp (I do recommend to globally install it using either npm install -g node-gyp or yarn global add node-gyp)

How to build it yourself

  1. First clone the repo
git clone https://github.com/Izurii/Lenovo-Y720-KB-Led-Controller
  1. Build
yarn build

How to start the software using yarn

yarn start

Good to know

  • Both scripts (build and start) has a lot of things behind doing all the dirty work.
  • yarn run build or yarn build do these actions:
    • As soon as you run the command, yarn will trigger the "prebuild" script, the prebuild script is going to run the sh file ./scripts/prebuild_start.sh. This shell script is going to run all the things needed to build the application, take a look at the script and see what it does.
    • The same logic applies to yarn run start it runs the file ./scripts/prebuild_start.sh
  • You can take a look at the README inside the folder ./scripts if you want more details in what those scripts is doing.
  • I wrote some details how the addons I built for the app works

lenovo-y720-kb-led-controller's People

Contributors

izurii avatar mmalisz 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lenovo-y720-kb-led-controller's Issues

Add support for Lenovo Legion 5 Pro (2021)

Is your feature request related to a problem? Please describe.
This app seems 95% close to working on a Lenovo Legion 5 Pro, 2021 edition (16ACH6H), but the latest release isn't able to.

Describe the solution you'd like
I'd like to work with a contributor to get this working on my recently purchased laptop, which is running Linux Mint 20.1 ("ulyssa") with a 5.13.0 -based kernel.

Describe alternatives you've considered
I couldn't find any similar app for Lenovo laptops, so this app is the most promising solution I'm aware of. I tried running this app as-is (release 1.8.60), but it didn't work.

Additional context
I suspect this laptop is nearly compatible with the app for several reasons:

  • I think the laptop keyboard has 4 rgb zones. So it's conceivable that app's current artwork image of a laptop keyboard could be abused to represent my laptop keyboard's lighting zones as well. I.e., my laptop probably has at most the same number of zones currently presented by the app.
  • It looks like my laptop's rgb controller is provided by ITE Tech Inc., just like the app was designed for. So it seems plausible that the ABI for controlling the lights is similar to what the app currently assumes:
/sys/class/hidraw$ for d in hidraw0 hidraw2 hidraw2 hidraw3; do echo "=== ${d} ==="; cat "${d}/device/uevent"; done
=== hidraw0 ===
DRIVER=hid-multitouch
HID_ID=0018:000006CB:0000CE78
HID_NAME=MSFT0001:00 06CB:CE78
HID_PHYS=i2c-MSFT0001:00
HID_UNIQ=
MODALIAS=hid:b0018g0004v000006CBp0000CE78
=== hidraw2 ===
DRIVER=hid-generic
HID_ID=0003:0000048D:0000C965
HID_NAME=ITE Tech. Inc. ITE Device(8295)
HID_PHYS=usb-0000:06:00.4-3/input1
HID_UNIQ=
MODALIAS=hid:b0003g0001v0000048Dp0000C965
=== hidraw2 ===
DRIVER=hid-generic
HID_ID=0003:0000048D:0000C965
HID_NAME=ITE Tech. Inc. ITE Device(8295)
HID_PHYS=usb-0000:06:00.4-3/input1
HID_UNIQ=
MODALIAS=hid:b0003g0001v0000048Dp0000C965
=== hidraw3 ===
DRIVER=hid-generic
HID_ID=0003:0000048D:0000C101
HID_NAME=ITE Tech. Inc. ITE Device(8910)
HID_PHYS=usb-0000:06:00.3-4/input0
HID_UNIQ=
MODALIAS=hid:b0003g0001v0000048Dp0000C101

When Using 2+ Profiles They Do Not Keep Their Settings

Describe the bug
Only the first profile keeps it's color setting. Any additional profiles "mix" or lose or don't save their color settings.

To Reproduce
Steps to reproduce the behavior:

  1. Create a profile
  2. Create a second profile with a different color
  3. Create a third profile with another different color
  4. Switch back to second profile and it should now have the third profile's color instead of it's correct color.
  5. Notice that the color settings for the second and third profile are shared or not saving separately.

Expected behavior
The profiles maintain their color and animation separately

Desktop (please complete the following information):

  • OS: Linux/Ubuntu
  • Version 20.04.2 LTS

Input device not found

When i try to execute it on Manjaro Linux, Xfce 4.16 it tells me the "Input device not found"

I didn't found an answer for this issue no where. Someone has had this problem before?

WINDOWS VERSION

It will be so nice if it will work on Windows. It can be better than original app. For example, one thing that I really need in original version is posibility to change the duration of changing colors in "wave" mode.

I'm full of hope 👯

Not working on Elementary OS

Hi,
Thank you for your quick reply. Here is my request again as a bug like you asked:
version v1.8.40-apocalypse does not work either.

I was looking for a solution to activate the LED from my Lenovo on elementary OS.
Unfortunately your solution does not work. :(

Is there a possibility, that you would make it work? That would be awesome.

Screenshot from 2021-05-17 01-58-29

Add support for Windows as well.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Escape for whitespace not working in .desktop file

journalctl reports this error
Dec 06 20:52:54 hostname systemd-xdg-autostart-generator[3490]: /home/george/.config/autostart/y720-kb-led-controller.desktop:6: Undefined escape sequence \ .

Desktop:

  • OS: Manjaro Linux 21.2.0
  • Kernel: Linux 5.10.79-1-MANJARO

Support for Y900

Hidraw0 is correctly identified:
HID_NAME=ITE33D1:00 048D:837A

But when starting the app, it returns 'Input device not found error', which I guess is related to different ids of the keyboard.
Keyboard in Y900:
ID=0003:000004B4:00000825
ID_VENDOR=04B4
ID_PRODUCT=0825
NAME=Full Speed Keyboard
Part of dmesg where inputs are registered:
[ 3.610763] input: Full Speed Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/0003:04B4:0825.0004/input/input10
[ 3.668851] hid-generic 0003:04B4:0825.0004: input,hidraw3: USB HID v1.11 Keyboard [Full Speed Keyboard] on usb-0000:00:14.0-4/input0
[ 3.671966] input: Full Speed Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:04B4:0825.0005/input/input11
[ 3.728756] input: Full Speed Keyboard Wireless Radio Control as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:04B4:0825.0005/input/input12
[ 3.729020] input: Full Speed Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:04B4:0825.0005/input/input13
[ 3.729348] input: Full Speed Keyboard as /devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.1/0003:04B4:0825.0005/input/input14
[ 3.729991] hid-generic 0003:04B4:0825.0005: input,hiddev0,hidraw4: USB HID v1.11 Keyboard [Full Speed Keyboard] on usb-0000:00:14.0-4/input1

ls -lR /dev/input:
lrwxrwxrwx 1 root root 10 cze 21 21:40 usb-04b4_Full_Speed_Keyboard-event-if01 -> ../event12
lrwxrwxrwx 1 root root 9 cze 21 21:40 usb-04b4_Full_Speed_Keyboard-event-kbd -> ../event9

Hotkey doesn't work

Describe the bug
The hotkey is not detected.

To Reproduce
Steps to reproduce the behavior:

  1. Open the application
  2. Press FN + Space
  3. The profile hasn't been changed

Expected behavior
The profiles are changed.

Desktop (please complete the following information):

  • Debian 11
  • xinput version 1.6.3
  • XI version on server: 2.3

My guess is that in this line https://github.com/Izurii/Lenovo-Y720-KB-Led-Controller/blob/master/main.js#L251 the regex should be more precies, as xinput returns:

xinput --list | tee | grep -v "Radio" | grep "ITE.*8910.*keyboard"
    ↳ ITE Tech. Inc. ITE Device(8910) Keyboard	id=11	[slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Consumer Control	id=17	[slave  keyboard (3)]

The device with id-11 doesn't catch the Fn + key combinations, whereas the id=17 does.
Additionally, the xinput --test 17 doesn't detect regular keystrokes and just outputs them.

PS. The README file should state that xinput is required to handle the hotkey.
I didn't have it installed and just got some errors, however the app itself was working.

Support for IdeaPad Gaming 3 15IHU6 82K1

Thank you very much for this software. I am partially sighted and bought this entry level L.T. for the keyboard back light but have not been able to get it to work. I have tried more than a dozen linux distros and have spoken to lenovo support without success. This back light has only a single zone and a single colour with Fn Space to cycle the white leds through pwm-level-1, pwm-level-2, pwm-level-3 and back down to off. My hardware probe is here https://linux-hardware.org/?probe=ab553d3a2f#Host This usb keyboard is also by ITE (8176) yours is probably (8910).

It would be really great for me and others if this LT could use your software.

latest beta doesn't work on Ubuntu 20.04

version 1.8.60 works great, there is only some small problem with saving profiles, I have to create a profile and then turn off and on again the application to fully save created profile, otherwise it overwrites one of already existing profiles

I installed 1.8.80 beta but now changing colours doesn't work, I see that pressing fn+space changes profiles in application, but keyboard is black all the time. Switching back to 1.8.60 fixes the problem.

btw. great app, been looking for something like that since 2 years. Thank you :D

Add support for Y910

Here is the result of the command sudo cat /sys/class/hidraw/hidraw*/device/uevent | egrep 'HID_(NAME|ID)' :

HID_ID=0018:0000048D:0000837A
HID_NAME=ITE33D1:00 048D:837A
HID_ID=0003:000004B4:00000825
HID_NAME=Full Speed Keyboard
HID_ID=0003:000004B4:00000825
HID_NAME=Full Speed Keyboard

It's an Ideapad LENOVO Y910-17, Intel i7-6820HK, W10-H 17.3" FHD, 24GB, 256GB SSD + 1TB [80V10018MZ]
Bought in February 2017.

Thanks for this great initiative.

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.