Closed vic1184 closed 1 year ago
Hi!
Try adding this to the beginning of the makefile:
ccflags-y := -std=gnu11 -Wno-declaration-after-statement
Also I'm pretty sure your EC version isn't supported yet so we're going to need your help in adding it
It seems to have solved the issue regarding the "for" loop but I keep on getting this error:
/home/vic/msi-ec/msi-ec.c: In function ‘msi_platform_remove’:
/home/vic/msi-ec/msi-ec.c:1414:9: error: implicit declaration of function ‘kvfree’; did you mean ‘vfree’? [-Werror=implicit-function-declaration]
1414 | kvfree(msi_root_group.attrs);
| ^~
| vfree
Also sure, if I can be of any help I'd happy to do so!
Looks like it can't locate the kvfree function declaration
Can you add the following line to the beginning of the msi-ec.c
file:
#include <linux/slab.h>
If it doesn't work either, maybe replacing kvfree with kfree will help
Thanks. Adding the library didn't help so I replaced the kvfree function with kfree. It compiled without fatal errors, but still doesn't work. I get the following error:
vic@Vic1184-GP66:~/msi-ec$ sudo make make[1]: ingresso nella directory «/usr/src/linux-headers-5.15.0-60-generic» CC [M] /home/vic/msi-ec/msi-ec.o MODPOST /home/vic/msi-ec/Module.symvers CC [M] /home/vic/msi-ec/msi-ec.mod.o LD [M] /home/vic/msi-ec/msi-ec.ko BTF [M] /home/vic/msi-ec/msi-ec.ko Skipping BTF generation for /home/vic/msi-ec/msi-ec.ko due to unavailability of vmlinux make[1]: uscita dalla directory «/usr/src/linux-headers-5.15.0-60-generic»
If I try to run make install I get this:
_vic@Vic1184-GP66:~/msi-ec$ sudo make install mkdir -p /lib/modules/5.15.0-60-generic/extra cp msi-ec.ko /lib/modules/5.15.0-60-generic/extra depmod -a echo msi-ec > /etc/modules-load.d/msi-ec.conf modprobe -v msi-ec insmod /lib/modules/5.15.0-60-generic/extra/msi-ec.ko modprobe: ERROR: could not insert 'msiec': Operation not supported make: *** [Makefile:29: install] Errore 1
modprobe: ERROR: could not insert 'msi_ec': Operation not supported
Yep, your EC version isn't supported. You can make sure by checking your dmesg (sudo dmesg
)
I'm working on a debug mode for this driver which will let you load this module in a debug mode and collect some info for me, so I can add a config for your firmware
Great! This is my dmesg output. Very long so I uploaded it here:
https://pastebin.com/Yu37QqMr (password: wwTHBQaJa2)
Yep, this line:
Your firmware version is not supported!
means it didn't find a config for your version.
I'll write here when the debug mode is ready, probably today
I'm back!
I already implemented EC dump, which I think is pretty sufficient, so if you don't want to wait until it gets merged you can get it from my repo:
clone -b debug_mode https://github.com/teackot/msi-ec.git
make
sudo make load-debug
To get an EC dump run this command:
for i in {1..10}; do echo "\ndump #$i:" >> ec_dump.txt; cat /sys/devices/platform/msi-ec/ec_dump >> ec_dump.txt; sleep 1; done
If you have windows, you can also try this app and play around with settings in the official MSI app to see the changes in EC memory
Hello. I've done as you said with your repo, however I still get some big errors doing it:
_vic@Vic1184-GP66: $ git clone -b debug_mode https://github.com/teackot/msi-ec.git
Clone in 'msi-ec' in corso...
remote: Enumerating objects: 247, done.
remote: Counting objects: 100% (73/73), done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 247 (delta 31), reused 33 (delta 21), pack-reused 174
Ricezione degli oggetti: 100% (247/247), 84.81 KiB | 835.00 KiB/s, fatto.
Risoluzione dei delta: 100% (150/150), fatto.
vic@Vic1184-GP66: $ cd msi-ec/
vic@Vic1184-GP66: /msi-ec$ make
make[1]: ingresso nella directory «/usr/src/linux-headers-5.15.0-60-generic»
CC [M] /home/vic/msi-ec/msi-ec.o
MODPOST /home/vic/msi-ec/Module.symvers
CC [M] /home/vic/msi-ec/msi-ec.mod.o
LD [M] /home/vic/msi-ec/msi-ec.ko
BTF [M] /home/vic/msi-ec/msi-ec.ko
Skipping BTF generation for /home/vic/msi-ec/msi-ec.ko due to unavailability of vmlinux
make[1]: uscita dalla directory «/usr/src/linux-headers-5.15.0-60-generic»
vic@Vic1184-GP66: /msi-ec$ sudo make load-debug
[sudo] password di vic:
insmod msi-ec.ko debug=1
vic@Vic1184-GP66: /msi-ec$ for i in {1..10}; do echo "\ndump #$i:" >> ec_dump.txt; cat /sys/devices/platform/msi-ec/debug/ec_dump >> ec_dump.txt; sleep 1; done
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ec_dump: File o directory non esistente
cat: /sys/devices/platform/msi-ec/debug/ecdump: File o directory non esistente
"File o directory non esistente" means that the file or the directory does not exist. If I navigate to /sys/devices/platform/msi-ec/ I can't see any debug folder there. There is a file called ec_dump in /sys/devices/platform/msi-ec but I don't know if that's what you're after. Looking at the date it seems like it was just created so I'm adding it here for good measure:
https://pastebin.com/A1QhhNbm password: ErV05CQ6Bx
I started the test with the keyboard backlighting on level 2 and I played with it around. I have in total 4 levels + off.
Also, it seems like MsiEcRamEditor can't read anything on Windows 11. I'm running it as administrator but all it shows is zeros. Changing a value inside MSI Dragon Center or pressing a shortcut on the keyboard does nothing.
means that the file or the directory does not exist
Yeah, sorry, I moved it from debug/ to the root of the platform driver and forgot to edit the comment. Edited now
There is a file called ec_dump in /sys/devices/platform/msi-ec but I don't know if that's what you're after
Yes, it is the right file.
Judging by your dump:
kbd backlight may be [0xf3]
Also, it seems like MsiEcRamEditor can't read anything on Windows 11
Try RWEverything, as suggested in this reddit post I found. In addition to changing settings in Dragon Center, please also toggle your backlight, mute and mic mute LEDs
Hello. So 1) Yes, it charges all the way to 100%. I have disabled the "battery saver" thing on windows. 2) I think it was. I can enable or disable it using the keyboard. 4) Same as 2) but it was off when I created the ec_dump file.
This is what I was able to see using Windows: https://www.youtube.com/watch?v=gJpAj26e6ec
Thanks! I'll watch your video and add a configuration to the driver
I'll move the conversation about the laptop to a new issue since this got closed
Hello! I've downloaded your repo on Linux Mint 21.1 and trying to run the Makefile returns the following error message:
_make[1]: ingresso nella directory «/usr/src/linux-headers-5.15.0-60-generic» CC [M] /home/vic/msi-ec/msi-ec.o /home/vic/msi-ec/msi-ec.c: In function ‘available_shift_modes_show’: /home/vic/msi-ec/msi-ec.c:928:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 928 | for (int i = 0; conf.shift_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c:928:9: note: use option ‘-std=c99’, ‘-std=gnu99’, ‘-std=c11’ or ‘-std=gnu11’ to compile your code /home/vic/msi-ec/msi-ec.c: In function ‘shift_mode_show’: /home/vic/msi-ec/msi-ec.c:954:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 954 | for (int i = 0; conf.shift_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘shift_mode_store’: /home/vic/msi-ec/msi-ec.c:971:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 971 | for (int i = 0; conf.shift_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘available_fan_modes_show’: /home/vic/msi-ec/msi-ec.c:1031:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 1031 | for (int i = 0; conf.fan_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘fan_mode_show’: /home/vic/msi-ec/msi-ec.c:1053:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 1053 | for (int i = 0; conf.fan_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘fan_mode_store’: /home/vic/msi-ec/msi-ec.c:1069:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 1069 | for (int i = 0; conf.fan_mode.modes[i].name; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘msi_platform_probe’: /home/vic/msi-ec/msi-ec.c:1396:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 1396 | for (int i = 0, j = 0; i < attributes_count; i++) { | ^~~ /home/vic/msi-ec/msi-ec.c: In function ‘msi_platform_remove’: /home/vic/msi-ec/msi-ec.c:1414:9: error: implicit declaration of function ‘kvfree’; did you mean ‘vfree’? [-Werror=implicit-function-declaration] 1414 | kvfree(msi_root_group.attrs); | ^
~| vfree /home/vic/msi-ec/msi-ec.c: In function ‘loadconfiguration’: /home/vic/msi-ec/msi-ec.c:1524:9: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode 1524 | for (int i = 0; CONFIGURATIONS[i]; i++) { | ^~~ cc1: some warnings being treated as errors make[2]: [scripts/Makefile.build:297: /home/vic/msi-ec/msi-ec.o] Errore 1 make[1]: [Makefile:1904: /home/vic/msi-ec] Errore 2 make[1]: uscita dalla directory «/usr/src/linux-headers-5.15.0-60-generic» make: *** [Makefile:10: modules] Errore 2There are not any damaged packages in my system and I installed build-essential and linux-headers-generic before running the makefile.
I've tried declaring the counters outside the "for" loop (right above where it starts) in the msi-ec.c file but I get some warnings instead and the fatal error at line 1414 regarding the implicit declaration of "kvfree". I'm running the makefile as root.
This is my inxi -b output in case it's needed:
_System: Host: Vic1184-GP66 Kernel: 5.15.0-60-generic x8664 bits: 64 Desktop: Cinnamon 5.6.7 Distro: Linux Mint 21.1 Vera Machine: Type: Laptop System: Micro-Star product: GP66 Leopard 10UG v: REV:1.0 serial:
Mobo: Micro-Star model: MS-1542 v: REV:1.0 serial:
UEFI: American Megatrends v: E1542IMS.30A date: 03/09/2021
Battery:
ID-1: BAT1 charge: 34.6 Wh (72.5%) condition: 47.7/63.2 Wh (75.4%)
CPU:
Info: 6-core Intel Core i7-10750H [MT MCP] speed (MHz): avg: 3477
min/max: 800/5000
Graphics:
Device-1: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] driver: nvidia
v: 525.78.01
Device-2: Acer HD Webcam type: USB driver: uvcvideo
Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: nvidia
unloaded: fbdev,modesetting,nouveau,vesa gpu: nvidia
resolution: 1920x1080~144Hz
OpenGL: renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
v: 4.6.0 NVIDIA 525.78.01
Network:
Device-1: Intel Comet Lake PCH CNVi WiFi driver: iwlwifi
Device-2: Intel driver: igc
Drives:
Local Storage: total: 709.83 GiB used: 291.21 GiB (41.0%)
Info:
Processes: 390 Uptime: 7m Memory: 15.52 GiB used: 2.69 GiB (17.3%)
Shell: Bash inxi: 3.3.13
Thanks a lot for the help!