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

Keyboard's backlight lights up for only a split second on my MSI GS76 & turns off again! #46

Open
OuttaBody opened this issue Jun 19, 2022 · 10 comments

Comments

@OuttaBody
Copy link

Hi folks,

I'm running Manjaro Linux (KDE Plasma Version: 5.24.5, Kernel Version: 5.18.0-1-rt11-MANJARO 64-bit) on MSI GS76 laptop. I've been trying to get the keyboard backlight to work on my laptop. And I need your help.

With MSIKLM, I got the "No compatible keyboard found" error. I fixed that problem by inserting the correct vendor id (1038) and product id (113A) in the code for the keyboard my laptop uses.

hid_device* open_keyboard()
{
    hid_device* dev = NULL;
    if (hid_init() == 0)
        dev = hid_open(0x1038, 0x113A, 0);
    return dev;
}

I recompiled the code. When I ran sudo msiklm test, I got the message "Compatible keyboard found!". So far so good! But when I run any of the commands below with valid argument, the backlight on my keyboard lights up for only a split second and turns off again. Any idea what the problem is or any solution to this problem? I really need this to work. It looks like I'm so close, but not quite there yet! As long as the keyboard backlight lights up, I don't really care what color it is...! I just need to be able to type in the dark. Thank you!

sudo msiklm green
sudo msiklm green,blue,red
sudo msiklm wave
sudo msiklm green high
sudo msiklm green,blue,red wave
sudo msiklm green,blue,red high wave

@Gibtnix
Copy link
Owner

Gibtnix commented Jun 19, 2022

Your keyboard uses a different command structure. I don't know which exactly, so its hard to say how to get your keyboard working. My first suggestion would be to test the things you already tested. So it seems that the command at least is partially correct. So how to proceed?
First, I suggest testing all colors without intensity argument. Second, testing all colors with intensity argument (high, maybe also low or medium).
If these two do not work for you, test all modes alone without any color options.
Thereafter, the last test is to use sudo msiklm wave but modify the set_mode function's code (cf. msiklm.c) and test whatever command structure you want. I do not know how the bytes have to be set, but at least you can change the buffer variable's content to whatever you might think is worth testing.
Finally, my only remaining suggestion is to use Windows in combination with a tool like Wireshark and try to log the communication to find out what's the correct command.

@rolandixor
Copy link

Any progress on this one? I had brief success with my keyboard, but then after the system went to sleep, it stopped working again. See here: https://askubuntu.com/questions/1416415/how-to-enable-keyboard-backlight-in-msi-ge-76-raider-11ue/1417036#1417036

@Gibtnix
Copy link
Owner

Gibtnix commented Jul 4, 2022

Are you referring to general functionality issues (i.e. more recent notebooks might not be supported) or to automatic resets from sleep/resume?
These two are completely different things. General compatibility issues are caused by unknown command structures that depend on the actual keyboard/notebook. I'm open to implement any as long as I know them. The reset from resuming after sleep just requires to execute the program once after resuming. Still, this can be achieved automatically but this depends on your distribution. More details are explained in the readme, still feel free to ask any questions as long as there is something unclear.

@rolandixor
Copy link

General functionality issues.

The sleep/resume issue is harder to pinpoint, as is getting it to work on startup. For some reason (even as I type this), the keyboard is working just fine, but I can't tell when it will turn on or off.

@OuttaBody
Copy link
Author

OuttaBody commented Jun 20, 2023

Hello folks!

Let me reiterate the whole thing! I have MSI GS76 and (Linux) Manjaro installed. Everything with Manjaro worked perfectly other than the keyboard backlight.

They keyboard backlight is not simply a flashy or fancy accessory for me, but it is a must as I type things on my computer either in very dim light or no light at all at night! So, I really and truly needed the keyboard backlight to work! That's why I was hellbent on getting the keyboard backlight to work. I didn't care about the fancy and flashy keyboard backlight color functions or patterns. All I simply wanted was the keyboard backlight to light up. That's all.

I searched the internet and many different forums for months and longer than a year. I found no solution and with everything I tried I came to a dead-end and cluttered the operating system by installing bunch of stuff that didn't work or help at the end.

And finally another user (ulrickpsp) at github responded to another message I posted at the link below. With his simple solution, the keyboard backlight on my MSI GS76 laptop worked! I could not believe my eyes! I give all the credit to "ulrickpsp".
Askannz/msi-perkeyrgb#52

Very shortly, let me state what I did.

  1. I installed msi-perkeyrgb
  2. If you scroll up to the very first message I posted here, you'll see that I figured out the
    1- vendor id (1038) and 2- product id (113A)
  3. Type the command below, in terminal. "-p" below means pulsing. The keyboard backlight turns on and off in sequence. As you see after "--id", I inserted "1038:113a". It is specific to my laptop. When you scroll back up to the first post here, by following the steps, you will find your own computer's vendor and product id and insert your own product and vendor id instead of "1038:113a"
    sudo msi-perkeyrgb --model GS75 --id 1038:113a -p aqua

As I said above, I didn't want or care about pulsing keyboard backlight. I just wanted the keyboard backlight to say on "solid". To do that, I replaced "-p" with "-s" as below. When I used "-s", it didn't recognize (understand) aqua color, probably it was not defined. So, instead of using the name "aqua", I had to use the corresponding number (ffffff) when I had to use "-s" for my own purpose. If you want steady (solid) keyboard backlight color of your choice, you can replace "ffffff" with your preference. Once you define the keyboard backlight color, it still keeps the keyboard backlight color even after you reboot the computer or even after you update your current kernel. That's my experience. It may be different in your experience, depending on how your setup is or what Linux distro you have, installed. So, please keep that in mind. (Also, I have GS76, but still I had to go with "GS75" as shown below because GS76 was not supported or included in "msi-perkeyrgb", but it still worked!?!)
sudo msi-perkeyrgb --model GS75 --id 1038:113a -s ffffff

Here is the key. Here is what turned the keyboard backlight on.
Find your device identifier under the folder below
/sys/bus/usb/drivers/usb/

Don't ask me why, but as I understand it, Linux sees the keyboard as a usb device. You may see folders like
3-10
3-11
3-12
3-14

"3-10" may be for the mouse. "3-11" may be for webcam. "3-12" may be for the keyboard..

Even though I was told to type the command below, to find the keyboard number. I had an error because Manjaro didn't recognize the "-T" argument in the command. So, I went with "3-12" because the person (who was helping me) had the same laptop as mine (MSI GS76) and his number was "3-12". In worse case, you just have to try whatever folder numbers you see under "/sys/bus/usb/drivers/usb/"
mesg -T | grep -i usb

Get the superuser privilege by typing the command below (It may be different in your Linux distro).
sudo su

Then type the command below to turn on the keyboard backlight once and for all! Yeah!?! (Don't forget to replace '3-12' below with whatever corresponding number is, for your keyboard.)
echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

Since you don't want to type the command below each time you reboot your computer, create a simple script with the instruction below to automatically start at every boot-up. That's all.
echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

Good luck!

@Gibtnix
Copy link
Owner

Gibtnix commented Jun 21, 2023

Good to know that you find a working solution 👍

@rolandixor
Copy link

rolandixor commented Dec 2, 2023

Hello folks!

Let me reiterate the whole thing! I have MSI GS76 and (Linux) Manjaro installed. Everything with Manjaro worked perfectly other than the keyboard backlight.

They keyboard backlight is not simply a flashy or fancy accessory for me, but it is a must as I type things on my computer either in very dim light or no light at all at night! So, I really and truly needed the keyboard backlight to work! That's why I was hellbent on getting the keyboard backlight to work. I didn't care about the fancy and flashy keyboard backlight color functions or patterns. All I simply wanted was the keyboard backlight to light up. That's all.

I searched the internet and many different forums for months and longer than a year. I found no solution and with everything I tried I came to a dead-end and cluttered the operating system by installing bunch of stuff that didn't work or help at the end.

And finally another user (ulrickpsp) at github responded to another message I posted at the link below. With his simple solution, the keyboard backlight on my MSI GS76 laptop worked! I could not believe my eyes! I give all the credit to "ulrickpsp". Askannz/msi-perkeyrgb#52

Very shortly, let me state what I did.

  1. I installed msi-perkeyrgb
  2. If you scroll up to the very first message I posted here, you'll see that I figured out the
    1- vendor id (1038) and 2- product id (113A)
  3. Type the command below, in terminal. "-p" below means pulsing. The keyboard backlight turns on and off in sequence. As you see after "--id", I inserted "1038:113a". It is specific to my laptop. When you scroll back up to the first post here, by following the steps, you will find your own computer's vendor and product id and insert your own product and vendor id instead of "1038:113a"
    sudo msi-perkeyrgb --model GS75 --id 1038:113a -p aqua

As I said above, I didn't want or care about pulsing keyboard backlight. I just wanted the keyboard backlight to say on "solid". To do that, I replaced "-p" with "-s" as below. When I used "-s", it didn't recognize (understand) aqua color, probably it was not defined. So, instead of using the name "aqua", I had to use the corresponding number (ffffff) when I had to use "-s" for my own purpose. If you want steady (solid) keyboard backlight color of your choice, you can replace "ffffff" with your preference. Once you define the keyboard backlight color, it still keeps the keyboard backlight color even after you reboot the computer or even after you update your current kernel. That's my experience. It may be different in your experience, depending on how your setup is or what Linux distro you have, installed. So, please keep that in mind. (Also, I have GS76, but still I had to go with "GS75" as shown below because GS76 was not supported or included in "msi-perkeyrgb", but it still worked!?!) sudo msi-perkeyrgb --model GS75 --id 1038:113a -s ffffff

Here is the key. Here is what turned the keyboard backlight on. Find your device identifier under the folder below /sys/bus/usb/drivers/usb/

Don't ask me why, but as I understand it, Linux sees the keyboard as a usb device. You may see folders like 3-10 3-11 3-12 3-14

"3-10" may be for the mouse. "3-11" may be for webcam. "3-12" may be for the keyboard..

Even though I was told to type the command below, to find the keyboard number. I had an error because Manjaro didn't recognize the "-T" argument in the command. So, I went with "3-12" because the person (who was helping me) had the same laptop as mine (MSI GS76) and his number was "3-12". In worse case, you just have to try whatever folder numbers you see under "/sys/bus/usb/drivers/usb/" mesg -T | grep -i usb

Get the superuser privilege by typing the command below (It may be different in your Linux distro). sudo su

Then type the command below to turn on the keyboard backlight once and for all! Yeah!?! (Don't forget to replace '3-12' below with whatever corresponding number is, for your keyboard.) echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

Since you don't want to type the command below each time you reboot your computer, create a simple script with the instruction below to automatically start at every boot-up. That's all. echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

Good luck!

Didn't work for me on Ubuntu 23.10.

Update:
After rebooting to Windows, SteelSeries GG wouldn't start. I rebooted the system (Windows hung), then out of the blue, the keyboard backlight worked in Ubuntu. I hope it stays on when I plug the system back in because it normally stops. I'm almost scared to try rebooting again and see if it sticks lol.

@OuttaBody
Copy link
Author

Rolandixor, make sure both services python-setuptools and hidapi are also installed. They are required by msi-perkeyrgb.
sudo pacman -S --needed python-setuptools hidapi

Also, each time you reboot your computer, you need to run the command below to turn on the keyboard backlight.
echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

So, you need to create a simple script with the instruction below to automatically start at every boot-up. That's all.
echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind

I hope it helps.

@rolandixor
Copy link

rolandixor commented Dec 2, 2023 via email

@OuttaBody
Copy link
Author

The solution worked until I plugged in my power cord. There seems to be a weird quirk that prevents the back light from staying on once external power is connected.

That's really strange! I feel like saying that it may have to do with power (energy) saving adjustments in Ubuntu. But there is no such feature relating to the keyboard backlight, as much as I know.

Here is what I think it might be. Whatever state the keyboard backlight turns on in Ubuntu, it may remember that state and turn it off when there is any "change" to the previous state. You may, kind of, need to initialize (start) the keyboard backlight when your power source is connected and see what happens.

Also, it sounds like you have dual boot system, (Windows and Ubuntu), which is fine. For the most part, it is how the BIOS interact with Linux.

For example, I don't need to set up a keyboard backlight color theme in Manjaro. Whatever keyboard backlight color theme is selected in Windows, Linux recognizes as default and keeps it and goes with it.

I've never had such problem with my system the problem that you're having. I'm using Manjaro KDE Plasma (Arch Linux Distro). I wanted to get away from Windows for the longest and tried many other Linux distros, but unfortunately I kept having to go back to Windows due to software problems. Meaning, the Linux distro didn't have the software. Even if it did, it didn't work properly. Sometimes the issue was components the laptop had... that I could not get them to work. Sometimes, the Linux distro seemed rather "blah" until I finally found Manjaro and gave it a try.

Ever since I started using Manjaro (with KDE Plasma desktop environment), I never looked back. It has everything I need and want and more. Now compared to Manjaro, Windows seems "blah" to me. My main concern with Windows was privacy and security. Microsoft is in the pockets of the 3-letter agencies. I don't even want to get into corporate greed and incompetence!

Anyway, my only issue with Manjaro was the keyboard backlight on my gaming laptop that I could not get it to work, no matter what I did or how much I tried, but I never gave up. I knew that solution was out there. Where there is a will, there is a way! Finally, my keyboard backlight works with Manjaro now. Everything in Manjaro is set up perfectly, working fine as if my laptop came with it.

Here is what I want you to try if the keyboard backlight doesn't work when you turn on Ubuntu, which is better than rebooting your system. Go into terminal, first type the command to have admin rights. In my system, it is "sudo su". In yours, it may be different.

Assuming that it is '3-12' for your system too, if it is a different number, change it to whatever it is for your system.

Also, assuming that inside this folder (/sys/bus/usb/drivers/usb/), you have one file called "bind", and another one called "unbind" and also have a folder called "3-12". When this folder "3-12" is in unbind state, you won't be able to see it though!

When you type the command below, the folder "3-12" will be released for you to see it in your file manager when you look in "/sys/bus/usb/drivers/usb/bind".

echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/bind

So far, all we're doing is making sure such folder "3-12" exists in "/sys/bus/usb/drivers/usb/bind". That's all. Nothing more!

When you turn on Ubuntu, if your keyboard backlight doesn't work, go into terminal. Type
sudo su [enter] (or the corresponding command for you to have admin rights)

echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/bind [enter]

echo '3-12' |sudo tee /sys/bus/usb/drivers/usb/unbind [enter]

After you bind, and then unbind, the keyboard backlight should turn on without having to reboot your computer.

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

No branches or pull requests

3 participants