BeardOverflow / msi-ec

GNU General Public License v2.0
134 stars 41 forks source link

Added support for MSI GS66 12UGS #126

Open Kinue72 opened 1 month ago

Kinue72 commented 1 month ago

Laptop Model

MSI GS66 12UGS

EC firmware version

16V5EMS1.107

EC memory dump

     | _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _a _b _c _d _e _f
-----+------------------------------------------------
0x0_ | 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2_ | 00 00 00 00 00 00 00 00 0a 05 00 00 00 04 3b 4b
0x3_ | 03 09 00 0d 03 00 50 81 6a 18 60 3b 71 02 e0 00
0x4_ | 00 00 62 00 81 14 00 00 fb 13 ae 40 1c 0c 00 00
0x5_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x6_ | 00 00 00 00 00 00 00 00 3d 00 37 3c 41 46 5a 5f
0x7_ | 64 41 2d 32 3c 41 50 55 64 00 08 07 05 05 05 03
0x8_ | 37 00 32 3c 46 52 5a 5d 64 2d 00 2d 3c 46 50 55
0x9_ | 64 00 03 05 05 06 03 03 02 0f 78 02 0f 78 3e 00
0xa_ | 31 36 56 35 45 4d 53 31 2e 31 30 37 31 32 31 34
0xb_ | 32 30 32 32 31 35 3a 33 30 3a 31 37 00 00 00 08
0xc_ | 00 00 07 25 00 00 00 00 00 9b 00 9d 00 c0 00 00
0xd_ | 00 00 c1 83 0d 00 05 80 00 01 00 00 00 08 00 00
0xe_ | e2 00 00 81 14 01 00 40 00 00 00 00 00 c2 00 00
0xf_ | 00 00 70 00 36 7f 05 37 41 00 03 c0 00 03 01 00

GPU

Intel & Nvidia

Is your keyboard RGB?

Per key RGB

Additional context

Both rt_temp_address and bs_fan_speed_address are valid addresses but need tweak the base_min and base_max values. Keyboard backlighting control isn't working, it seems to be controlled by Steelseries GG. Also, FN key swap returns opposite values.

glpnk commented 1 month ago

Thanks!

Do you have similar to photo keyboard layout or regular [ ctrl | fn | win | alt ] MSI Cyborg 15 A12VF

Kinue72 commented 1 month ago

Image took from NotebookCheck

img

Kinue72 commented 1 month ago

After some investigation, when you hold FN, the keyboard led is the highlight key that supports the function. If swap in EC memory, it swaps the key, but the highlight is wrong. For example, my current FN is actually FN, but when I hold the left WIN key, it highlights but is still functional as a WIN key. The fn key has, but it is actual fn. When I opened MsiCenter in DnSpy, I found that this efi variable might store data for fn swap and power share MsiDCVarData-DD96BAAF-145E-4F56-B1CF-193256298E99

glpnk commented 1 month ago

I don't think EFI vars is used as an interface to change settings, at least not directly. But it could be used to apply changes after reboot.

Settings being written to hardware via WMI interface, but EFI vars is like cache, I think

glpnk commented 1 month ago

Via WMI interface on WMI2 devices, you can read/write EC RAM values. https://github.com/timschneeb/MsiEcRamEditor

DO NOT TRY TO WRITE ANYTHING TO EC IF YOU NOT 100% SURE WHAT YOU'RE DOING

But it only works for WMI2 devices, which are Intel 11+ gen and AMD 7 gen (only gaming series) CPU based devices

glpnk commented 1 month ago

Windows has a way to log WMI requests, which look similar to SQL language SELECT queries. But it's messed. I've used this tool on my WMI1 device, but don't get anything interesting. On WMI2 should be better. https://github.com/Alois-xx/WMIWatcher

If you want to do deep dive into this check #98

Kinue72 commented 1 month ago

All offsets are copy from MsiCenter except the UEFI variable one, maybe it refresh cache or something when reboot?

glpnk commented 1 month ago

my current FN is actually FN, but when I hold the left WIN key, it highlights but is still functional as a WIN key

From some laptop videos I've learned that in some devices keyboard controller and EC is different microcontrollers, but for you looks like only RGB controller is separate. So you change settings in EC/KB-controller, but RGB controller do not received that changes and highlight older layout

glpnk commented 1 month ago

All offsets are copy from MsiCenter except the UEFI variable one, maybe it refresh cache or something when reboot?

IDK, but on Linux I can't change EFI vars, for changing like boot order and other boot settings. This might work on Windows, but when I last time dumped these vars it was zeroed

But MSI Center also use registry and config files, so it shouldn't have problems with loosing data from this EFI vars

glpnk commented 1 month ago

On the latest kernel or soon, you can use lm-sensors to get a cooler RPM.

glpnk commented 1 month ago

So your keyboard seems reporting backlight level, but when you change value in EC nothing happens?

Kinue72 commented 1 month ago

So your keyboard seems reporting backlight level, but when you change value in EC nothing happens?

Yes, I see changed in EC memory but when write nothing happens.

glpnk commented 1 month ago

I found that this efi variable might store data for fn swap and power share MsiDCVarData-DD96BAAF-145E-4F56-B1CF-193256298E99

Actually, BIOS may use this variable to communicate with MSI Center about these settings to keep them in sync.

But for me, when I swapped EC-WIN from MSI Center Pro or EC, this setting just vanished from BIOS

glpnk commented 1 month ago

Does FN key highlighting works on Linux?

Kinue72 commented 1 month ago

Does FN key highlighting works on Linux?

It works but it desync when I swap fn and win.

glpnk commented 1 month ago

How your keyboard is detected? As USB device? Or USB only for backlight control. But if there are any USB devices, it may use SMBUS/I2C interface

Kinue72 commented 1 month ago

How your keyboard is detected? As USB device? Or USB only for backlight control. But if there are any USB devices, it may use SMBUS/I2C interface

IDK, Here is my lsusb image

glpnk commented 1 month ago

Someone experimented with it in OpenRGB on similar device https://gitlab.com/CalcProgrammer1/OpenRGB/-/issues/2642

Probably on FN-WIN swap something inside MSI Center or its backend triggers SteelSeries driver