Askannz / msi-perkeyrgb

Linux CLI tool to control per-key RGB lighting on MSI laptops.
MIT License
214 stars 39 forks source link

Sending an effect without transitions bricks the backlight #24

Open rodolpheh opened 5 years ago

rodolpheh commented 5 years ago

After trying to create and use an effect through a configuration file, I completely lost the ability to have keyboard backlight, following an hidapi error :

At first reboot, the SteelSeries keyboard wasn't showing up in lsusb. It started showing up again after a full shutdown. I tried to update the UEFI BIOS firmware (following the MSI instructions) to see if it would reset the keyboard but it did not.

Here is the configuration file that made my keyboard crash and triggered the hidapi error (sorry I did not logged it and I can't make it appear again) :

all steady ff0000
arrows steady 0000ff
numpad steady 00ff00

effect test
  start ffffff
  wave 0 0 x 100 out
end

all effect test

My laptop model is a MSI GE65 Raider 9SE

My system is 5.3.7-arch1-1-ARCH x86_64 GNU/Linux

My msi-perkeyrgb version is 1.4_effects_alpha, built from the AUR this morning (which shows a bump to version 2 normally)

The SteelSeries keyboard is showing in lsusb as Bus 001 Device 004: ID 1038:1122 SteelSeries ApS SteelSeries KLC

And finally, greping SteelSeries in dmesg give me :

[    2.689366] usb 1-9: Product: SteelSeries KLC
[    2.689367] usb 1-9: Manufacturer: SteelSeries
[    2.690642] hid-generic 0003:1038:1122.0004: hiddev2,hidraw3: USB HID v1.11 Device [SteelSeries SteelSeries KLC] on usb-0000:00:14.0-9/input0
[    2.691132] input: SteelSeries SteelSeries KLC as /devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9:1.1/0003:1038:1122.0005/input/input13
[    2.747859] hid-generic 0003:1038:1122.0005: input,hidraw4: USB HID v1.11 Device [SteelSeries SteelSeries KLC] on usb-0000:00:14.0-9/input1

When I now use msi-perkeyrgb, it doesn't output anything.

Did you happen to stumble on such issue ? Does anyone knows a way to solve this ?

Let me know if you need more information

ErrorErrorError commented 3 years ago

I guess your best option at this point is to replace your keyboard.

If they still want to add the effects there should be an assertion that has at least one transition to avoid this situation.

TauAkiou commented 3 years ago

What we need here is a way of clearing the keyboard's NVRAM, not the firmware. You would think that they would offer a way to do that as a recovery or reset mechanism, but apparently not.

@ErrorErrorError I added a check in my branch (the original effects branch) to fail if there isn't at least one transition: https://github.com/TauAkiou/msi-perkeyrgb/commit/7d32728c642b7ffe27d6d42c29d67a688de73687

More checking might be necessary to make absolutely sure this state is never passed to the keyboard, but that isn't going to recover the keyboards that were bricked by this.

ErrorErrorError commented 3 years ago

What we need here is a way of clearing the keyboard's NVRAM, not the firmware. You would think that they would offer a way to do that as a recovery or reset mechanism, but apparently not.

It couldn't be an issue with EC also? Because you can still communicate with the keyboard but it does not seem to write the bits to the NVRAM or overwriting it.

I did notice that sometimes SteelSeries sends a different initial package number when writing ouput to HID. https://github.com/Askannz/msi-perkeyrgb/blob/87c92ac23a81372a2ad604a7421bf0da6dbc4f08/msi_perkeyrgb/msiprotocol.py#L170

On my system it sends 0x0d instead of 0x09 and I use 0x0d for my implementation on macOS. I am not sure if changing to 0x0d can help reset the transitions with this https://github.com/Askannz/msi-perkeyrgb/issues/24#issuecomment-547706337 but it's worth a shot.

rodolpheh commented 3 years ago

MSI says they can't support that, SteelSeries says to contact MSI because they don't do anything, only the SteelSeries Engine software (which according to a recent article on Gizmodo, is a piece of junk with security holes). I think it's not worth trying to get help from either of them.

sergei66666 commented 2 years ago

Hello. It is not direct for you keyboards, but may be give you some insigths https://www.youtube.com/watch?v=iMP9mGKfQw0

alula commented 2 years ago

Have you tried this? https://us.msi.com/support/technical_details/NB_KB_SteelSeries

ErrorErrorError commented 2 years ago

Have you tried this? https://us.msi.com/support/technical_details/NB_KB_SteelSeries

It's a hardware issue, not a software issue unfortunately.

JorgeSivil commented 2 years ago

Hello! I tried this software in ubuntu 22.04 and got some python errors, unfortunately I tried again.

Lights flashed once and then the keyboard disappeared from lsusb

Lights were not working even while booting.

After a poweroff they work while booting, though not very well... but in Windows they don't work. Neither in Ubuntu, I guess I bricked my keyboard.

In normal mode, the number 4 or so flashes white, the x flashed red, but nothing more. In rainbow, more keys seems to work

JorgeSivil commented 2 years ago

Well after I entered the SteelSeries app and odified soe things and saved, the keyboard looks like working again except the m which was working as my previous post works. Will try messing again with that software and saving

JorgeSivil commented 2 years ago

OK after setting the DEFAULT mode, clicking the M to change it, then pressing SAVE, now my keyboard is back thank god, at least in Windows and the m works.

image

It does seem like something is still messed up as when I boot the only one or two keys blink for a second then turn off, and in Ubuntu after logging in the power button switches from red to white for some seconds.

But in Windows the backlight is working at least.

I removed the udev rules in Ubuntu and removed the msi-perkeyrgb just in case it was trying to apply rules on boot but that issue is still happening, and iirc it was working correctly from boot to stop before (for Windows).

But I can live with that as long as the rgb is working at least in Windows.

N0madical commented 1 year ago

Ello

Do you know if this is an issue that could be patched so full animations are available again?

NovHak-Linux commented 1 year ago

MSI says they can't support that, SteelSeries says to contact MSI because they don't do anything, only the SteelSeries Engine software (which according to a recent article on Gizmodo, is a piece of junk with security holes). I think it's not worth trying to get help from either of them.

I’m coming late here, but just to say that it’s not just SteelSeries software that’s a piece of junk, MSI software too. Moreover, their support is absolute zero when it comes to tell how their own hardware works. I wanted to know which commands are sent to the EC to get some functionality such as enabling/disabling display overdrive so I can program it myself on Linux, but since I said the magical word “Linux”, they just answered they don’t support Linux… except I didn’t ask for any help on Linux, only how the hardware works so I can implement functionality on Linux, but they don’t seem to get it or don’t want to understand.

In the end I managed to enable/disable overdrive on Linux, but it’s probably not the best way to do it, thanks MSI ! It was the first time I bought from them, but as things go, with their junk programs, Windows-centric mind, lack of cooperation and some other hardware problems I encountered, I don’t see how my next laptop could be an MSI, that’s for sure.

brokencog commented 8 months ago

This is really necromancing here ... but ... Having read through the posts to get here; I haven't seen anyone doing a correct Electronic Controller reset.

That link to MSI says 'hold the power down for 30 seconds while disconnected from mains". That isn't sufficient, and unnecessary on some models.

My GE76 takes a 30 second press on the EC reset button on the machine underside while disconnected. Then on re-connecting to mains; holding the power on for five seconds or so.

That has reset my EC several times.

It could be some peculiarity with the GE76 since none of the other SS effect writers around github and elsewhere seem to work either; none of them even mentioning support for this model.

NovHak-Linux commented 8 months ago

@brokencog As I mentioned in a previous post, the backlight isn’t managed by the Embedded Controller, at least not on my GP76, otherwise the problem would be solved easily, it’s on the keyboard electronics directly. Some non-laptop keyboards have a reset procedure, but I have seen none for laptop keyboards (which doesn’t mean there is none, just that it’s not been disclosed).

brokencog commented 8 months ago

@NovHak-Linux I read that comment - it and several others mention 'reset' of the EC, but nothing in the descriptions would indicate the EC actually being reset ... removing the battery, flashing BIOS and holding the power button will not reset the EC.

NovHak-Linux commented 8 months ago

@brokencog I suppose your argument here is that the kb backlight may be managed by the EC after all, just that none of us did reset it properly, but since you did it, I guess you were able to see if it indeed had any effect on the SS keyboard configuration… so did it ? Additionally, could you point us to the source were you got the proper reset procedure ?

But anyway, now that I rethink of it, it’s very unlikely that EC is in charge of this : is has too many important things in charge, such as fan management, CPU reset, battery management (in the case of my GP76 at least), to have fancy lighting added to the list. Considering SS desktop keyboards manage this internally, it’s probably the same with the laptop ones.

brokencog commented 8 months ago

@NovHak-Linux I am not sure if this is the same mention of it ... but this gives a summary. [It's ironic they link to the same MSI instructions which were described in this thread ...]

I wasn't suggesting you were wrong (despite your snarky assumption) because a) your laptop model could very well have different circuitry and b) what required a reset on my keyboard controller might not do so on yours.

However, the steps mentioned in this thread of comments does NOT mention the procedure linked above which is exactly what I wrote initially.

I needed to do a reset after crashing the controller with a different program (MSIKLM) and then resetting it via the above command.

To quickly determine if that method is viable for you - flip the laptop over and look for a tiny reset hole adjacent to a small, circulary-looking icon. Mine is lower left of the center screw. If so, chances are 99% likely that is the EC reset pin. Plenty of images online.

Note: I have only succeed with the reset when holding the pin for 30 seconds. So, when you test it, count all the elephants ;)>

rodolpheh commented 8 months ago

We can quickly close this debate: I've done this method, this was the first one I did, because it's the most quoted one when googling how to reset EC on MSI.

brokencog commented 8 months ago

@rodolpheh Why is it a debate?? What's being debated?? How should I know "this was the first one you did"? Nothing in this thread described the reset procedure I linked -- and as I already wrote I don't claim it works universally, but I do claim what others have described in this thread is insufficient; I'm holding at least one hardware model for which it doesn't work. Hence my posting an additional reset mechanism.

I will point out that "the most quoted one" from google responses is entirely subjective. For instance it isn't until the fifth or sixth result of searching "msi laptop ec electronic controller reset" in which I see a YouTube description of the method using the underside reset button, all the others reference the power button method.

rodolpheh commented 7 months ago

Maybe "debate" wasn't the right term, you'd have to forgive me as English isn't my native language. I appreciate that you are trying to help on a thread that is 4 years old. Just to reassure you, I tried your method right now, which I'm pretty sure I tried years ago, and it didn't fix it. I know that the EC reset method was successful as before because the computer goes into a different booting cycle (which according to some info I read years ago means that it was successfully done).

You'd have to forgive me but I spent countless hours reading MSI documentations and user manual so in my memory it felt like the information was pretty out there. Maybe it came about at the tenth page of Google searches, at a time when Google didn't suck that much.

Askannz commented 7 months ago

Wow, I'm amazed this thread is still alive. Please keep the discussion civil.

I had tried the reset button too at the time, without success. After reading @brokencog comment I just did it one more time (more out of curiosity than to fix a laptop that's quite literally falling apart at this point). The machine does seem to go into a different boot mode but the keyboard lights won't come up.

brokencog commented 7 months ago

@Askannz just to be clear, the reset button isn't going to change how msi-perkeyrgb functions, if it didn't change LED colors before still won't do so after the rest.

Also, a confirmation that the resetting the EC worked is with the laptop power disconnected, pressing the power-on button does not do anything. One needs to re-connect the power then press the power button for a few moments. This is because battery charge level's and other stuff are also reset and the laptop won't attempt to recharge without being connected to mains.

rodolpheh commented 7 months ago

Yes I can confirm that I had to power the laptop to turn it on and upon boot it was showing a low level of battery which quickly got up. And I remember clearly the same thing happening 4 years ago when this issue was first opened.

I think Askannz is aware that this wouldn't change things in msi-perkeyrgb as they are the author of msi-perkeyrgb. In case you missed it, the subject of the issue is that a wrong command bricked the backlight of our keyboards, which means that they do not have any backlight at all. Seeing it light up would indicate a massive progress, that's why Askannz was pointing out the absence of light.

JorgeSivil commented 7 months ago

But if you boot into Windows and use the official MSI keyboard software to configure the keyboard, doesn't it come back to life? It happened to me and it came back with that. Except the "m" that wasn't working but worked after a remap

rodolpheh commented 7 months ago

I do not have Windows installed on this machine. In your issue however you report that the keys were lighting up on boot, which sounds like they are not completely bricked. In our case, no lights comes on at boot, and in my case even the power button uses the wrong LED. Askannz previously tried the SteelSeries software and it didn't solve their issue, might be worth trying again in case they updated their software to unbrick bricked keyboards but I'd doubt that.

brokencog commented 7 months ago

I read his comment about your keyboard being bricked. That's exactly why I commented. Let me make a very linear explanation of why I made the initial comment, because I don't feel the hostility (albeit somewhat mild and primarily from a single user) is warranted despite my having raised a four? year old thread without a definitive solution.

  1. after initial purchase of laptop several years ago, find this repo (and others) looking for software to configure my current laptop keyboard.
  2. read comment of keyboard becoming in-op.
  3. decide not to risk damaging laptop and work without LED keys enabled.
  4. after several years, revisit in hopes of a solution.
  5. decide to try anyway [trivial addition of GE76 model VID/PID values]. keyboard becomes in-op with no lights, Win10 SS Engine fails to find keyboard, etc.
  6. read through entire thread looking for steps to reset keyboard.
  7. try posted reset method using power button, which doesn't work.
  8. search web for alternative reset method using EC reset button on laptop underside.
  9. return here and fail to find any description matching "the alternative" reset procedure .
  10. post alternative method.

It's unfortunate it doesn't work for others -- as I wrote I never made any assertion it was a universal solution; only that this thread didn't have any indication of this "alternative" method being attempted and it seemed to me worth mentioning.

Thanks for the response, obviously it's possible to control the LEDs so hopefully a solution will be found eventually.

Also, @rodolpheh are you still unable to control the keyboard LEDs via the Win10 SS Engine software?

rodolpheh commented 7 months ago

My memory is not very good and I haven't gone through the whole thread, but I do not remember reading about a method that only involves pressing the power button. As a matter of fact, the first comment in which I reference the EC reset talks about holding the button under the laptop, which is the EC reset one (with power disconnected) which is what MSI recommended at the time and still recommend when searching how to reset the EC on Google.

As for Windows, I unfortunately do not have Windows on this machine and do not have enough storage to dual-boot on it. EDIT: I'm willing to try on a VM if I have the storage and the time, but it did not work last time I tried

TauAkiou commented 7 months ago

my guess has always been that the MSI keyboard IC controller is a seperate USB device that powers up on system boot and operates independently from the rest of the system, not unlike any other USB device out there.

unless MSI/Steelseries changed that, then I don't see any reason it wouldn't be different on later models. perhaps it might work for you, but other people that faced this bug have not had much success with it.

i would not use the old version here, but instead the original fork in which I added some checking to prevent the user from entering an invalid transition combination, at your own risk: https://github.com/TauAkiou/msi-perkeyrgb

i couldn't vouch whether or not this works on newer laptops, either since this was created and debugged on a MSI GS65 back in 2019. my GS65 has since broken, so it's unlikely I will be doing any more work on that branch.

brokencog commented 7 months ago

@rodolpheh I feel like we are describing something different??

There are two methods of resetting the EC:

  1. remove power cord, press and hold the power button for 30 seconds. This is described in the link to the above comment as well as being the MSI "official" reset method.
  2. remove power cord, press and hold the EC reset button on the bottom of the laptop. This is never mentioned in this thread. It is not discussed by MSI.

Reading your recent comment, forgive me for being confused but, it doesn't seem like method 2 has been tried. I know you mentioned earlier doing so, but that comment was not clear to me either.

I haven't tried using the SS Engine in a VM. I'll install Win10 VM and check the Engine works virtually. It didn't work in Wine, unsurprisingly, but I suspect a VM would succeed.

@TauAkiou I agree that the EC is connected as a USB device. Otherwise we wouldn't be able to capture the interaction via Wireshark's USB interface capture. I don't know how much MSI changes internal products from model to model. I am on a GE76 from 2021 (not sure the year).

rodolpheh commented 7 months ago

I know it will make me sound crazy but Google still has in cache the information that was on MSI's website, see attached picture. A picture of a Google search showing that Google's featured snippet refers to the EC reset hole at the bottom of the laptop The link in this picture doesn't talk about the EC button though.

Sorry for the confusion. My original comment from above did refer to the button under the laptop.

EDIT: the link featured in the picture is not the right one. I've found out that MSI's website has been changed. The oldest backup from the wayback machine refers to the EC reset hole, hence the confusion.

TauAkiou commented 7 months ago

@rodolpheh I feel like we are describing something different??

There are two methods of resetting the EC:

1. remove power cord, press and hold the power button for 30 seconds.  This is described in the link to the above comment as well as being the MSI "official" reset method.

2. remove power cord, press and hold the EC reset button on the bottom of the laptop.  This is never mentioned in this thread.  It is not discussed by MSI.

Reading your recent comment, forgive me for being confused but, it doesn't seem like method 2 has been tried. I know you mentioned earlier doing so, but that comment was not clear to me either.

I haven't tried using the SS Engine in a VM. I'll install Win10 VM and check the Engine works virtually. It didn't work in Wine, unsurprisingly, but I suspect a VM would succeed.

@TauAkiou I agree that the EC is connected as a USB device. Otherwise we wouldn't be able to capture the interaction via Wireshark's USB interface capture. I don't know how much MSI changes internal products from model to model. I am on a GE76 from 2021 (not sure the year).

that's not entirely what i meant - i theorized that the keyboard itself had a NVRAM chip that stores the keyboard settings. this is how i suspect that the keyboard knows the previous effect when the laptop is powered down.

i don't think this chip is connected to the EC controller in any meaningful way, which means that if the keyboard gets an invalid configuration and that configuration gets saved to NVRAM, it will attempt to load the invalid state on every boot. this is what I believed was happening with the zero transition bug.

i don't know if MSI/SS fixed this issue in later hardware iterations, but it reeks of bad design. this scenario could also theoretically be caused by a bug in the Windows steelseries software as well or some other sort of corruption to a similar if not the same effect, or simply if the NVRAM ends up being somehow corrupted.