Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cconvey opened this issue Jul 6, 2021 · 29 comments
Open

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

cconvey opened this issue Jul 6, 2021 · 29 comments
Assignees
Labels
enhancement New feature or request

Comments

@cconvey
Copy link

cconvey commented Jul 6, 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
@Izurii Izurii self-assigned this Jul 10, 2021
@Izurii Izurii added the enhancement New feature or request label Jul 10, 2021
@Izurii
Copy link
Owner

Izurii commented Jul 10, 2021

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
Copy link
Owner

Izurii commented Jul 10, 2021

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

@cconvey
Copy link
Author

cconvey commented Jul 10, 2021

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
Copy link
Owner

Izurii commented Jul 11, 2021

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
Copy link
Author

cconvey commented Jul 11, 2021

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 [email protected]: 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
Copy link

auberginebeardsley commented Jul 23, 2021

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
Copy link
Owner

Izurii commented Aug 2, 2021

@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
Copy link
Author

cconvey commented Aug 2, 2021

Any of you have windows installed in your laptop?

My Windows installation is thoroughly deleted, unfortunately.

@dausruddin
Copy link

dausruddin commented Aug 2, 2021

The software used for Lenovo 5 Pro is Lenovo Vantage.

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

@Izurii
Copy link
Owner

Izurii commented Aug 2, 2021

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

@dausruddin
Copy link

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

@Izurii
Copy link
Owner

Izurii commented Aug 2, 2021

@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
Copy link

dausruddin commented Aug 2, 2021

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
Copy link
Owner

Izurii commented Aug 2, 2021

@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
Copy link

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
Copy link
Owner

Izurii commented Aug 2, 2021

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

@dausruddin
Copy link

Thank you😁

@auberginebeardsley
Copy link

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

@chillmatin
Copy link

Thank you! I am waiting for solution very unpatiently lol

@rustyx
Copy link

rustyx commented Sep 24, 2021

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
Copy link

gnomiik commented Oct 9, 2021

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

@lucidtyper
Copy link

lucidtyper commented Oct 10, 2021

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
Copy link

imShara commented Oct 13, 2021

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
Copy link

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

@Izurii
Copy link
Owner

Izurii commented Nov 12, 2021

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 👍

@Izurii
Copy link
Owner

Izurii commented Nov 12, 2021

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
Copy link

imShara commented Nov 12, 2021

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
Copy link

iddo commented Dec 8, 2021

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
Copy link

imShara commented Dec 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants