Izurii / Lenovo-Y720-KB-Led-Controller

Controller for the backlight of the Lenovo Legion Y720 keyboard.
GNU General Public License v3.0
50 stars 13 forks source link

Add support for Lenovo Legion 5 Pro (2021) #31

Open cconvey opened 2 years ago

cconvey commented 2 years ago

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:

Izurii commented 2 years ago

By what I see, hidraw3 should be the device controlling the rgb of your keyboard.

I search the correct hidraw device by the name, for the chip ITE Device(8910) the name on Lenovo Y720 is HID_NAME=ITE33D1:00 048D:837A and in yours appears to be HID_NAME=ITE Tech. Inc. ITE Device(8910), so maybe if we just implement the name that your laptop uses for the chip, the software will start to work.

=== hidraw0 ===
DRIVER=hid-generic
HID_ID=0018:0000048D:0000837A
HID_NAME=ITE33D1:00 048D:837A
HID_PHYS=i2c-ITE33D1:00
HID_UNIQ=
MODALIAS=hid:b0018g0001v0000048Dp0000837A

Here's is the correct hidraw device from my laptop

Izurii commented 2 years ago

Can you do a xinput and comment what the command printed out?

cconvey commented 2 years ago

Thanks for considering this! As requested:

cjc@overlord:~$ xinput
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ ITE Tech. Inc. ITE Device(8910) Keyboard  id=11   [slave  pointer  (2)]
⎜   ↳ MSFT0001:00 06CB:CE78 Mouse               id=14   [slave  pointer  (2)]
⎜   ↳ MSFT0001:00 06CB:CE78 Touchpad            id=15   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C           id=9    [slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Wireless Radio Control    id=10   [slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8295) Keyboard  id=12   [slave  keyboard (3)]
    ↳ Ideapad extra buttons                     id=13   [slave  keyboard (3)]
    ↳ AT Raw Set 2 keyboard                     id=16   [slave  keyboard (3)]
    ↳ ITE Tech. Inc. ITE Device(8910) Keyboard  id=17   [slave  keyboard (3)]
Izurii commented 2 years ago

It seems to me that is the same chip as the Lenovo Y720. So it should work after I add the HID_NAME that your device uses for the ITE Device(8910). I'll be releasing a new version in the next few days.

cconvey commented 2 years ago

Thanks @Izurii !

I made that change to driver/index.js, and then tried to rebuild using yarn start. But unfortunately I get this error:

cjc@overlord:~/r/lzurii/Lenovo-Y720-KB-Led-Controller/master$ yarn start
yarn run v1.22.5
error y720-kb-led-controller@1.8.60-apocalypse: The engine "node" is incompatible with this module. Expected version "=14.16.0". Got "10.19.0"
error Commands cannot run with an incompatible environment.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Is this something I can easily fix? Or if not, would it be convenient for you to build a .deb or .tgz for me with the changed code?

auberginebeardsley commented 2 years ago

Is this something I can easily fix?

You need to update your node.js:

https://stackoverflow.com/questions/8191459/how-do-i-update-node-js/33010229#33010229

I ran into the same problem, but managed to get it built with the updated node.js. In fact I got the same Legion 5 laptop, changed the index.js and got the controller software to work, but while it starts, I still can't change the RGB lights via software, the lights stay the same, no matter what I change. So there seems to be something else that has to be adapted... Any ideas, anyone? :)

Izurii commented 2 years ago

@cconvey @auberginebeardsley Any of you have windows installed in your laptop? If yes, do you have the software from Lenovo that controls the keyboard RGB? If also yes, can you send me the software or tell me the name, this way I can take a look how the driver works for windows and maybe replicate it on this app.

cconvey commented 2 years ago

Any of you have windows installed in your laptop?

My Windows installation is thoroughly deleted, unfortunately.

dausruddin commented 2 years ago

The software used for Lenovo 5 Pro is Lenovo Vantage.

https://www.microsoft.com/en-us/p/lenovo-vantage/9wzdncrfj4mv

Izurii commented 2 years ago

@dausruddin Many thanks, do you have a Windows installation?

dausruddin commented 2 years ago

Yes. I am dualbooting. Feel free to ask me anything. I have been following this issue for a while :D

Izurii commented 2 years ago

@dausruddin So, can you check if, somewhere inside the folder where the Lenovo Vantage is installed you have a DLL with "LED" somewhere in the name?

dausruddin commented 2 years ago

Unfortunately I spotted none.

Folder: C:\Program Files (x86)\Lenovo\VantageService\3.7.19.0

List of files

C:\PROGRAM FILES (X86)\LENOVO
└───VantageService
    └───3.7.19.0
        │   Dia2Lib.dll
        │   iTin.Core.dll
        │   iTin.Core.Hardware.dll
        │   iTin.Core.Hardware.Specification.Dmi.dll
        │   iTin.Core.Hardware.Specification.Smbios.dll
        │   iTin.Core.Hardware.Specification.Tpm.dll
        │   Lenovo.CertificateValidation.dll
        │   Lenovo.ImController.Contracts.dll
        │   Lenovo.ImController.EventLogging.dll
        │   Lenovo.Modern.CoreTypes.dll
        │   Lenovo.Modern.ImController.ImClient.dll
        │   Lenovo.Modern.Utilities.dll
        │   Lenovo.Vantage.AddinHost.Amd64.exe
        │   Lenovo.Vantage.AddinHost.Amd64.exe.config
        │   Lenovo.Vantage.AddinHost.exe
        │   Lenovo.Vantage.AddinHost.exe.config
        │   Lenovo.Vantage.AddinHost.x86.exe
        │   Lenovo.Vantage.AddinHost.x86.exe.config
        │   Lenovo.Vantage.AddinInterface.dll
        │   Lenovo.Vantage.Dependency.dll
        │   Lenovo.Vantage.ImClient.dll
        │   Lenovo.Vantage.RpcClient.dll
        │   Lenovo.Vantage.RpcCommon.dll
        │   Lenovo.Vantage.RpcServer.dll
        │   Lenovo.Vantage.ServiceSetup.exe.config
        │   Lenovo.Vantage.SetupUtility.dll
        │   Lenovo.Vantage.Utilities.CVHelper.dll
        │   Lenovo.VantageService.dll
        │   Lenovo.VantageService.InstallerHelper.exe
        │   Lenovo.VantageService.InstallerHelper.exe.config
        │   Lenovo.VantageService.Utilities.dll
        │   LenovoVantageService.exe
        │   LenovoVantageService.exe.config
        │   LenovoVantageService.InstallLog
        │   LenovoVantageService.InstallState
        │   Microsoft.Diagnostics.FastSerialization.dll
        │   Microsoft.Diagnostics.Tracing.TraceEvent.dll
        │   Microsoft.Win32.TaskScheduler.dll
        │   Newtonsoft.Json.dll
        │   OpensourceLicenses.txt
        │   OSExtensions.dll
        │   ScheduleEventAction.exe
        │   ScheduleEventAction.exe.config
        │   SecureBlackbox.dll
        │   SecureBlackbox.HTTP.dll
        │   SecureBlackbox.HTTPCommon.dll
        │   SecureBlackbox.LDAP.dll
        │   SecureBlackbox.PGP.dll
        │   SecureBlackbox.SSLClient.dll
        │   SecureBlackbox.SSLCommon.dll
        │   SecureBlackbox.XML.dll
        │   SecureBlackbox.XMLSecurity.dll
        │   stateless.dll
        │   System.Data.SQLite.dll
        │   System.IdentityModel.Tokens.Jwt.dll
        │   System.Runtime.CompilerServices.Unsafe.dll
        │   TraceReloggerLib.dll
        │   Uninstall.exe
        │   Uninstall.exe.config
        │
        ├───de
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───es
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───fr
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───it
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───pl
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───ru
        │       Microsoft.Win32.TaskScheduler.resources.dll
        │
        ├───x64
        │       7zr.exe
        │       IntelSRAPI.dll
        │       SQLite.Interop.dll
        │       VantageRpcClient.dll
        │       VantageRpcServer.dll
        │
        ├───x86
        │       7zr.exe
        │       IntelSRAPI.dll
        │       SQLite.Interop.dll
        │       VantageRpcClient.dll
        │       VantageRpcServer.dll
        │
        └───zh-CN
                Microsoft.Win32.TaskScheduler.resources.dll
Izurii commented 2 years ago

@dausruddin I asked about this DLL because in the software used by the Lenovo Y720 this DLL is responsible for controlling the RGB backlight. Maybe is in another file, so if possible, can you upload the whole folder and send me a link? This way I can work my way up to find how the software works and implement this in my software.

dausruddin commented 2 years ago

Content of C:\Program Files (x86)\Lenovo: C-ProgramFiles x86-Lenovo.zip

I did a quick search and there is another folder that might interest you. C:\Windows\Lenovo C-Windows-Lenovo.zip

Izurii commented 2 years ago

@dausruddin Many thanks! I'll be taking a look and as soon as possible will come back here with some news

dausruddin commented 2 years ago

Thank you😁

auberginebeardsley commented 2 years ago

May I add a thank you as well? Thank you! :)

chillmatin commented 2 years ago

Thank you! I am waiting for solution very unpatiently lol

rustyx commented 2 years ago

Here's the updated LenovoVantage software. In there you can also find the screenshots of the LenovoVantage.exe. The "Lighting"->"Customize" button leads to the second screen, "Lighting", where you can select: Effect: Static, Breath, Smooth, Wave_Right, Wave_Left Brightness: 1 or 2 Divide Area: on = use 4 zones, off = 1 big zone. Then clicking on each zone, can select the color.

I found some references to the above strings in .js files under LenovoCompanion UWP app, but couldn't trace them to code as the JS is all minified.

gnomiik commented 2 years ago

Any updates for getting Legion 5 Pro support? It would be greatly appreciated! Thanks in advance!

lucidtyper commented 2 years ago

Hello there. I've been checking this thread and, even though I have a Lenovo Legion 5 (not pro), i have the same ITE Device(8910).

When trying to run I get this. image

imShara commented 2 years ago

I have made CLI tool to control leds on Legion 5 Pro 2021 on linux https://github.com/imShara/l5p-kbl Hope this helps.

dausruddin commented 2 years ago

Thanks @imShara !!! I have tested and it is working really good.

Izurii commented 2 years ago

I have made CLI tool to control leds on Legion 5 Pro 2021 on linux https://github.com/imShara/l5p-kbl Hope this helps.

Can I use your code to implement support for the Legion 5 Pro in mine? Of course, I'll be giving the credits for that :+1:

Izurii commented 2 years ago

Sorry for the delay folks. My work and studies is consuming my free time in a way I never seen before lol, but I'll be making fixes and updating this project soon!

imShara commented 2 years ago

I have made CLI tool to control leds on Legion 5 Pro 2021 on linux https://github.com/imShara/l5p-kbl Hope this helps.

Can I use your code to implement support for the Legion 5 Pro in mine? Of course, I'll be giving the credits for that +1

Yes, of course

iddo commented 2 years ago

I have made CLI tool to control leds on Legion 5 Pro 2021 on linux https://github.com/imShara/l5p-kbl Hope this helps.

@imShara thank you for your tool, I've learned how it works and tried to run it (with a slight modification) on my IdeaPad Gaming 3 which has a different keyboard model (VENDOR = 0x048D PRODUCT = 0xC966), but that caused the keyboard to stop responding, so I assume the payload is probably different for this model.

Can I ask how did you discover the correct payload?

imShara commented 2 years ago

I have made CLI tool to control leds on Legion 5 Pro 2021 on linux https://github.com/imShara/l5p-kbl Hope this helps.

@imShara thank you for your tool, I've learned how it works and tried to run it (with a slight modification) on my IdeaPad Gaming 3 which has a different keyboard model (VENDOR = 0x048D PRODUCT = 0xC966), but that caused the keyboard to stop responding, so I assume the payload is probably different for this model.

Can I ask how did you discover the correct payload?

In legion 5 pro there is three hidraw devices, and proper is NOT a keyboard actually. You can check right device from windows with wireshark and usbpcap. You should catch packages when shitching modes in lenovo vantage.