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

Support for Katana 15 B13VFK #185

Open
QkiZMR opened this issue Jan 6, 2025 · 30 comments
Open

Support for Katana 15 B13VFK #185

QkiZMR opened this issue Jan 6, 2025 · 30 comments
Labels
New firmware Request for a new firmware

Comments

@QkiZMR
Copy link

QkiZMR commented Jan 6, 2025

Laptop model

Katana 15 B13VFK

EC firmware version

1585EMS1.115

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 08 24 0b 4b
0x3_ | 03 01 00 05 00 00 52 81 d2 11 88 2c c8 01 c0 00
0x4_ | f8 11 51 00 80 11 00 00 01 0e 44 30 e7 0b fa 32
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 38 00 37 40 49 4c 52 58
0x7_ | 64 00 00 2b 30 36 3c 4b 55 64 08 03 03 03 03 03
0x8_ | 34 00 37 3d 43 49 4f 53 63 00 00 2b 30 36 3c 4b
0x9_ | 55 64 08 03 03 03 03 02 06 0f 7d 06 0a 78 37 00
0xa_ | 31 35 38 35 45 4d 53 31 2e 31 31 35 30 38 32 32
0xb_ | 32 30 32 34 31 33 3a 33 36 3a 31 36 00 00 00 08
0xc_ | 00 00 01 25 00 00 0f 00 00 00 00 00 00 00 00 00
0xd_ | 00 00 c1 83 0d 00 05 d0 00 05 00 0c 00 0a 00 00
0xe_ | e2 00 00 80 11 00 00 c1 00 01 00 00 00 c2 00 00
0xf_ | 00 00 70 00 00 64 00 00 64 00 00 00 00 00 00 00

GPU

Nvidia

Is your keyboard RGB?

Yes (multi color RGB)

Additional context

Hi. My task was made easier because all addresses were the same as in this issue but with different values. Here are the results of my tests.

Speaker mute LED 2D
LED off          24
LED on           26
Fn-lock LED D9 (works on Linux without software control)
LED off     05
LED on      07
Microphone LED 2C
LED off        08
LED on         0A
Battery thresholds D7 (looks like the mode chosen in Windows is saved in memory)
Best for mobility  E4
Balanced           D0
Best for battery   BC
Webcam toggle 2E no LED (works on Linux without software, when is turned off it appears in kernel logs as disconnecting USB device)
Turn off      09
Turn on       0B
FN<->Win E8
Normal   00
Swapped  10
User scenario D2 D3 D4 EB
Performance   C4 83 0D 00
Balanced      C1 83 0D 00
Quiet         C1 83 1D 00
Battery       C2 80 0D 0F
Fan mode      D4 98
Auto          0D 06
Cooler boost  0D 86
Advanced      8D 06
@QkiZMR QkiZMR added the New firmware Request for a new firmware label Jan 6, 2025
@mutchiko
Copy link
Contributor

in user scenario feature you report 4 addresses, usually its only 2 of them, could you please double check? EB is most likely related to charger detection

@glpnk
Copy link
Contributor

glpnk commented Jan 13, 2025

0xeb may be "super battery" or GPU toggle

0xd3 is keyboard

@glpnk
Copy link
Contributor

glpnk commented Jan 13, 2025

#194 same like here

@mutchiko
Copy link
Contributor

you're right, i confused it with 0xEF.

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

in user scenario feature you report 4 addresses, usually its only 2 of them, could you please double check? EB is most likely related to charger detection

I copied addresses from this issue. You have right, EB is for super battery.

0xd3 is keyboard

Probably yes. It changes when profile is switched to battery saving.
I already made changes but I need to test it because few things don't work, speaker muting LED for example. But this could be trigger problem. I need to investigate it.

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

When I try to save

echo 1 > /sys/class/leds/platform::mute/brightness

The LED lights up, so there's no problem with the address. /sys/class/leds/platform::mute/trigger is set to none by default. Even if I switch to audio-mute, it still doesn't work if I press Fn+F1 which is 🔇. Here is the kernel log:

14.01.2025 09:35	atkbd serio0	Unknown key pressed (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	atkbd serio0	Unknown key pressed (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	atkbd serio0	Unknown key pressed (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	atkbd serio0	Unknown key released (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	atkbd serio0	Unknown key pressed (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	atkbd serio0	Unknown key pressed (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.
14.01.2025 09:35	msi_wmi	Unknown event received
14.01.2025 09:35	atkbd serio0	Unknown key released (translated set 2, code 0xc0 on isa0060/serio0).
14.01.2025 09:35	atkbd serio0	Use 'setkeycodes e040 <keycode>' to make it known.

These messages are when I press 🔇 button on the laptop keyboard.

@mutchiko
Copy link
Contributor

for LED mute, you can try this solution: #130 (comment)

you need to apply it after each reboot

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

@QkiZMR Ignore this messages, they generated for MSI app for Windows and not used on Linux

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

for LED mute, you can try this solution: #130 (comment)

you need to apply it after each reboot

it works. I made systemd service to fix it:

[Unit]
Description=Speaker mute LED fix for MSI
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/bin/bash -c 'echo "Master Playback Switch" | tee /sys/class/sound
/ctl-led/speaker/card1/attach'

[Install]
WantedBy=multi-user.target

Now I'm testing other things. Will be back later.

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

I tested everything and nearly every feature is working fine. Two files are reporting zeros even if fans are working:

/sys/devices/platform/msi-ec/cpu/realtime_fan_speed
/sys/devices/platform/msi-ec/gpu/realtime_fan_speed

I think that I set up the wrong addresses. Need to check it.

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

Ignore them, they broken by design

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

What cpu.bs_fan_speed_address does?

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

This one unclear even for me. Some old models had 'basic' fan mode, where you could set target RPM or %

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

PR #195

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

I found that MControlCenter when using ec_sys module can show fan rpm.

Zrzut ekranu_20250114_173733

I dig into MControlCenter source code for fan speed addresses and found it.

It will be 0xcb for fan2 (GPU) and 0xc9 for fan1 (CPU). It is aligned with some other models.

Of course, it is one byte value so it must be multiplied by some number. /sys/devices/platform/msi-ec/gpu/realtime_fan_speed shows only raw value.

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

Exactly this feature is broken here, but you can usw lm-sensors package and sensors` command

Actually rpm is 2 byte size and require some calculations, which made in lm sensors driver

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

Actually, it's division

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

Just use lm sensors, I think it's possible to add this data to MCC

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

In my case, lm sensors don't see the fans.

 $  /e/modules-load.d  sensors 
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +54.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +51.0°C  (high = +100.0°C, crit = +100.0°C)
Core 4:        +54.0°C  (high = +100.0°C, crit = +100.0°C)
Core 8:        +51.0°C  (high = +100.0°C, crit = +100.0°C)
Core 12:       +48.0°C  (high = +100.0°C, crit = +100.0°C)
Core 16:       +49.0°C  (high = +100.0°C, crit = +100.0°C)
Core 20:       +48.0°C  (high = +100.0°C, crit = +100.0°C)
Core 24:       +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 25:       +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 26:       +50.0°C  (high = +100.0°C, crit = +100.0°C)
Core 27:       +50.0°C  (high = +100.0°C, crit = +100.0°C)

nvme-pci-0300
Adapter: PCI adapter
Composite:    +26.9°C  (low  = -40.1°C, high = +83.8°C)
                       (crit = +87.8°C)
Sensor 1:     +39.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +26.9°C  (low  = -273.1°C, high = +65261.8°C)

BAT1-acpi-0
Adapter: ACPI interface
in0:          12.36 V  
curr1:         0.00 A  

iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:            N/A  

spd5118-i2c-1-50
Adapter: SMBus I801 adapter at efa0
ERROR: Can't get value of subfeature temp1_max_alarm: Can't read
temp1:        +55.0°C  (low  =  +0.0°C, high = +55.0°C)
                       (crit low =  +0.0°C, crit = +85.0°C)

nvme-pci-0200
Adapter: PCI adapter
Composite:    +33.9°C  (low  =  -0.1°C, high = +86.8°C)
                       (crit = +89.8°C)
Sensor 1:     +34.9°C  (low  = -273.1°C, high = +65261.8°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +56.0°C  

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

Which kernel version you use? Check if you have right module

lsmod | grep msi

msi-wmi-platform

Also check dmesg, maybe loading fails

sudo dmesg | grep "WMI interface version"

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

Which kernel version you use? Check if you have right module

lsmod | grep msi

Kernel version: 6.11.0-1005-lowlatency

msi_ec                 32768  0
msi_wmi                16384  0
sparse_keymap          12288  2 intel_hid,msi_wmi
video                  77824  4 msi_wmi,xe,i915,nvidia_modeset
wmi                    28672  3 video,wmi_bmof,msi_wmi

Also check dmesg, maybe loading fails

sudo dmesg | grep "WMI interface version"

No output. But journalctl -b0 | grep -E "(wmi|WMI)" prints:

sty 14 11:51:35 katana kernel: wmi_bus wmi_bus-PNP0C14:00: [Firmware Bug]: WQAK data block query control method not found
sty 14 11:51:35 katana kernel: wmi_bus wmi_bus-PNP0C14:00: [Firmware Bug]: WQAL data block query control method not found
sty 14 11:51:35 katana kernel: wmi_bus wmi_bus-PNP0C14:00: [Firmware Bug]: WMAJ method block execution control method not found
sty 14 11:51:35 katana kernel: input: MSI WMI hotkeys as /devices/virtual/input/input13
sty 14 11:51:56 katana kernel: msi_wmi: Unknown event received

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

Ah, modprobe msi_wmi_platform do the job. Now I see fans speed:

 $  /e/modules-load.d  sensors
msi_wmi_platform-virtual-0
Adapter: Virtual device
fan1:           0 RPM
fan2:        2594 RPM
fan3:           0 RPM
fan4:           0 RPM
...

I thought that msi_wmi_platform and msi_wmi is same module.

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

I'm surprised that your kernel don't have it. Maybe because you have realtime kernel. Please 1 extra check:

modinfo msi-wmi-platform

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

With your help, I can try to find which file we should poke to get RPM from this module and add it to MCC.

I thought that msi_wmi_platform and msi_wmi is same module.

Yeah, some legacy stuff

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

Sure, I'm ready to help.

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

I hope that path to required hwmon instance will be simple

ls -l /sys/class/hwmon/

@QkiZMR
Copy link
Author

QkiZMR commented Jan 14, 2025

 ~  ls -l /sys/class/hwmon/                                                                                                                                                                              wto, 14 sty 2025, 22:11:58
razem 0
lrwxrwxrwx 1 root root 0 sty 14 22:09 hwmon0 -> ../../devices/pci0000:00/0000:00:1f.0/PNP0C09:00/ACPI0003:00/power_supply/ADP1/hwmon0/
lrwxrwxrwx 1 root root 0 sty 14 22:09 hwmon1 -> ../../devices/virtual/thermal/thermal_zone0/hwmon1/
lrwxrwxrwx 1 root root 0 sty 14 22:09 hwmon2 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:35/PNP0C09:00/PNP0C0A:00/power_supply/BAT1/hwmon2/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon3 -> ../../devices/pci0000:00/0000:00:06.0/0000:02:00.0/nvme/nvme1/hwmon3/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon4 -> ../../devices/pci0000:00/0000:00:06.2/0000:03:00.0/nvme/nvme0/hwmon4/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon5 -> ../../devices/platform/coretemp.0/hwmon/hwmon5/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon6 -> ../../devices/pci0000:00/0000:00:1f.0/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/ABBC0F6E-8EA1-11D1-00A0-C90629100000/hwmon/hwmon6/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon7 -> ../../devices/pci0000:00/0000:00:1f.4/i2c-1/1-0050/hwmon/hwmon7/
lrwxrwxrwx 1 root root 0 sty 14 22:10 hwmon8 -> ../../devices/virtual/thermal/thermal_zone6/hwmon8/

@glpnk
Copy link
Contributor

glpnk commented Jan 14, 2025

Okay, right one is hwmon6 -> ../../devices/pci0000:00/0000:00:1f.0/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/ABBC0F6E-8EA1-11D1-00A0-C90629100000/hwmon/hwmon6/ but it's too complex to use as is

@mutchiko
Copy link
Contributor

@QkiZMR little bit off subject here but, how did you install MControlCenter?

@QkiZMR
Copy link
Author

QkiZMR commented Jan 15, 2025

Okay, right one is hwmon6 -> ../../devices/pci0000:00/0000:00:1f.0/PNP0C09:00/PNP0C14:00/wmi_bus/wmi_bus-PNP0C14:00/ABBC0F6E-8EA1-11D1-00A0-C90629100000/hwmon/hwmon6/ but it's too complex to use as is

Yes, it's number 6. Conky can read hwmon so I used it to read fan speed after adding msi_wmi_platform module at system startup. Fan: ${hwmon 6 fan 1} RPM

@QkiZMR little bit off subject here but, how did you install MControlCenter?

According to the instructions, I used an embedded script. I'm using the 0.4.1 version because 0.5.0 uses libqtcore in a newer version than I have in the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New firmware Request for a new firmware
Projects
None yet
Development

No branches or pull requests

3 participants