ligius- / lenovo-backlight-control

Simple wrapper for Windows 8/10 to control the Thinkpad keyboard backlight
Apache License 2.0
40 stars 14 forks source link

Newer models #11

Open surubutna opened 2 years ago

surubutna commented 2 years ago

Hey! So, incredibly my newer Lenovo laptop doesn't turn the keyboard on by default and, after much searching, I got to this project.

I know you mention the newer DLL in the readme, and that's the one present on my laptop, but I've been trying unsuccessfully to make it work. Any chance of helping me get around this?

ligius- commented 2 years ago

Which model do you have? I can play with my newer Yoga, but not sure if my findings will be relevant. We can even set up some kind of a live session so we can test things out using PowerShell.

surubutna commented 2 years ago

Live session sounds like a good idea, I'd be down.

I have an Ideapad 5 Pro (16ACH6)

ligius- commented 2 years ago

Can you open a Powershell prompt and type the following, in groups:

$assembly = [System.Reflection.Assembly]::LoadFrom("c:\Users\All Users\Lenovo\ImController\Plugins\IdeaNotebookPlugin\x64\IdeaNotebookPlugin.dll" )
$agent = $assembly.GetTypes()[0].GetMethod("GetInstance").Invoke($null,$null)
$agent
$request = New-Object -TypeName Lenovo.Modern.Contracts.Keyboard.KeyboardSettingsRequest
$list = New-Object -TypeName Lenovo.Modern.Contracts.Keyboard.SettingList
$request.List = $list
$item0 = New-Object -TypeName Lenovo.Modern.Contracts.Keyboard.Setting
$item1 = New-Object -TypeName Lenovo.Modern.Contracts.Keyboard.Setting
$list.Items.Add($item0)
$list.Items.Add($item1)
$item0.key = "KeyboardBacklightLevel"
$item0.value = "OneLevel"  
$item1.key = "KeyboardBacklightStatus"
$item1.value = "Level_1"  

Disable the backlight from the Lenovo Vantage utility and then type in the following, in the same PS shell as above:

$agent.SetBacklightStatus($request)

The backlight should turn on if everything is working as expected. Now type, in the same shell:

$request.list.Items[1].value="Off"
$agent.SetBacklightStatus($request)

The backlight should turn off.

I will try to find some time to have a Discord chat or something similar where we can do a screen sharing session, if the above does not work.

surubutna commented 2 years ago

First of all, thanks for the reply and for taking the time to help me.

Second, it worked. I'm still trying to understand what the commands are doing, but they behaved like you expected.

ligius- commented 2 years ago

Cool, that's a good think, I think it might help a lot of people with similar issues. I just need to find the time to update the program to call a different function, plus it generally needs some cleanup as I haven't invested any time into it. The lines above create a KeyboardSettingsRequest object which has a list of settings. The list has two items with properties, KeyboardBacklightLevel=OneLevel and KeyboardBacklightStatus=Level_1. Afterwards I call the function SetBacklightStatus with the request built above.

You can try playing with different items in the settings, if you have time, here is a list of plausible values: image and a list of plausible keys: image There might be more, though pretty sure not all combinations work anyway. You can try out various levels and maybe report back so I can compile this information and figure out how to integrate it.

MikeWH commented 1 year ago

I can confirm the powershell commands above work on a Yoga 7i 16, thank you so much!

98mohitkumar commented 1 year ago

it's not working anymore after the latest vantage update :/, i tried to locate the dll file but it's not there anymore, is there any fix ?

erikjoya commented 1 year ago

$assembly = [System.Reflection.Assembly]::LoadFrom("C:\Users\All Users\Lenovo\Vantage\Addins\IdeaNotebookAddin\1.0.1.20\IdeaNotebookAddin.dll" )

use this location

98mohitkumar commented 1 year ago

$assembly = [System.Reflection.Assembly]::LoadFrom("C:\Users\All Users\Lenovo\Vantage\Addins\IdeaNotebookAddin\1.0.1.20\IdeaNotebookAddin.dll" )

use this location

This worked, thank you so much.

w0rknprogress commented 1 year ago

Can someone please explain how I can use those powershell commands to turn the backlight on at startup?

Running the powershell commands manually, they work and the backlight turns on (with the new location provided by @erikjoya), but've tried updating the .ps1 file and it seems to do nothing.

I've also tried to edit the .ahk script to the recent path, but no dice.

How can I make sure it turns on the backlight at startup or everytime I login?

Sorry for the questions, the README seems to skip a few steps and I'm kind of a beginner in AHK.

erikjoya commented 1 year ago

You need to enable powershell scripts if you want it to run during startup. It's normally disabled in windows due to security purposes

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: w0rknprogress @.> Sent: Monday, January 16, 2023 11:58:14 AM To: ligius-/lenovo-backlight-control @.> Cc: erikjoya @.>; Mention @.> Subject: Re: [ligius-/lenovo-backlight-control] Newer models (Issue #11)

Can someone please explain how I can use those powershell commands to turn the backlight on at startup?

Running the powershell commands manually, they work and the backlight turns on (with the new location provided by @erikjoyahttps://github.com/erikjoya), but've tried updating the .ps1 file and it seems to do nothing.

I've also tried to edit the .ahk script to the recent path, but no dice.

How can I make sure it turns on the backlight at startup or everytime I login?

Sorry for the questions, the README seems to skip a few steps and I'm kind of a beginner in AHK.

— Reply to this email directly, view it on GitHubhttps://github.com/ligius-/lenovo-backlight-control/issues/11#issuecomment-1383445532, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5G4FBI3AO4SIF5XB7ET53WSTBNLANCNFSM5G6JJP7Q. You are receiving this because you were mentioned.Message ID: @.***>

sumitbhowmick commented 1 year ago

I am trying to make this work on Legion 5 Pro, but without luck. I guess I'm missing something as I'm not familiar with Powershell. I'm using - C:\Users\All Users\Lenovo\Vantage\Addins\IdeaNotebookAddin\1.0.2.18\IdeaNotebookAddin.dll

Script & error screenshot attached. Screenshot Legion 5 Pro

Can anyone please help me resolve this issue. I'm open to have a working session. @ligius- @erikjoya Thanks in advance.