Skip to content

Implement the ability to change the backlight mode#648

Open
Fede2782 wants to merge 1 commit intoBeardOverflow:mainfrom
Fede2782:bkd_bl_mode
Open

Implement the ability to change the backlight mode#648
Fede2782 wants to merge 1 commit intoBeardOverflow:mainfrom
Fede2782:bkd_bl_mode

Conversation

@Fede2782
Copy link
Copy Markdown
Contributor

  • The config had values but they were unused up to this point

* The config had values but they were unused up to this point
@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 17, 2026

Does keyboard backlight being reliably triggered at all? I'm assuming it triggers only by keys, not by touchpad?

I'm comparing this with how this made by Asus

@Fede2782
Copy link
Copy Markdown
Contributor Author

Fede2782 commented Mar 17, 2026

Does keyboard backlight being reliably triggered at all? I'm assuming it triggers only by keys, not by touchpad?

I'm comparing this with how this made by Asus

here on modern 15 h ai c1mg-096, using touchpad does trigger backlight as well. i set this as WIP cause i'd like someone without the backlight to test it as well.

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 17, 2026

That's really nice, because my other laptops backlight from some chinese brand does not triggered by touchpad

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 17, 2026

Does toggling this setting affects backlight? Like idea of making KB glow when mice is moved or screen is touched

@Fede2782
Copy link
Copy Markdown
Contributor Author

Does toggling this setting affects backlight? Like idea of making KB glow when mice is moved or screen is touched

This setting only changes the mode. If backlight is on or off it's decided in the brightness attribute. This attribute might be managed by the DE so that keyboard could be triggered using external inputs such as mouse or keyboard.

When brightness attribute is greater than zero then the brightness mode is followed. If it's "timeout" then every time a key or touchpad is used it will stay on for 10s. If it's "always" then it will always stay on until brightness is set to 0.

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 17, 2026

You right but system does not know real state of backlight. You can read it, but DE will not update state without a trigger.

Is BL level is 0 when state is timeout and blank?

@Fede2782
Copy link
Copy Markdown
Contributor Author

You right but system does not know real state of backlight. You can read it, but DE will not update state without a trigger.

Is BL level is 0 when state is timeout and blank?

Once this module is installed everything knows and can control the backlight. KDE, for example, recognizes it and allows control of brightness intensity directly via its control panel. Therefore you could write an app to trigger the backlight anytime with any trigger you want since it is available in sysfs for apps.

BL level doesn't change if mode is timeout but the timeout has reached 10s and powered off. It remains untouched cause the keyboard backlight is already on but it has been temporarily disabled because timeout mode is set

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 18, 2026

I mean that KDE and other DEs can't know that you changed brightness with keyboard key

@Fede2782
Copy link
Copy Markdown
Contributor Author

Fede2782 commented Mar 18, 2026

I mean that KDE and other DEs can't know that you changed brightness with keyboard key

They could tho. Once you press the keyboard key the EC value gets updated and therefore the sysfs attribute does as well when being read. So using a watcher they could detect those changes.

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 18, 2026

Gnome have no watcher built in

Comment thread ec_memory_configuration.h
struct msi_ec_kbd_bl_conf {
int bl_mode_address;
int bl_modes[2];
struct msi_ec_mode bl_modes[5];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 5 not 3?

Because states are "always", "timeout" and NULL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 5 not 3?

Because states are "always", "timeout" and NULL

I have aligned with other modes definition. Also this allows better handling in case new modes are added in the future. This can be reduced to 3 if you think is necessary.

@Fede2782
Copy link
Copy Markdown
Contributor Author

Gnome have no watcher built in

I never said it has. I am saying that once this module is installed there are a lot of new possibilities and DEs could take advantage of them in every way you could possibly think of.

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 18, 2026

If you know how to tell DE that brightness is changed, can you say how to do this? At leas on KDE if you know.

This not related to this PR and to this repo at all. But there a design possibility to receive events about brightness and other soft keys through WMI. But this is related to msi-wmi-platform driver, not msi-ec

@Fede2782
Copy link
Copy Markdown
Contributor Author

If you know how to tell DE that brightness is changed, can you say how to do this? At leas on KDE if you know.

This not related to this PR and to this repo at all. But there a design possibility to receive events about brightness and other soft keys through WMI. But this is related to msi-wmi-platform driver, not msi-ec

I haven't thought of a precise solution but, as I stated in previous replies, a possible solution could be implementing a watcher which periodically checks the brightness value exported by this driver and does actions depending on that. I didn't consider getting events WMI, could be possible that as well

@glpnk
Copy link
Copy Markdown
Collaborator

glpnk commented Mar 18, 2026

I think this events are standard because DE can rotate screen based on gyroscope for example, so we need to just tell DE that something happened to update its internal state

@Fede2782 Fede2782 marked this pull request as ready for review March 18, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants