Open constructor-s opened 1 year ago
I got a bit adventurous and tried the cooler_boost. It works! The fan started humming.
$ echo "on" | sudo tee /sys/devices/platform/msi-ec/cooler_boost
on
$ echo "off" | sudo tee /sys/devices/platform/msi-ec/cooler_boost
off
I would like to explore some of unknown values here:
/sys/devices/platform/msi-ec/webcam /sys/devices/platform/msi-ec/win_key /sys/devices/platform/msi-ec/fn_key
Has your laptop these buttons? If so, what values are you getting for them (on/off for webcam, switch win/fn key)?
Also, a dmidecode
output can be useful for future improves in this module.
I would like to explore some of unknown values here:
/sys/devices/platform/msi-ec/webcam /sys/devices/platform/msi-ec/win_key /sys/devices/platform/msi-ec/fn_key
Has your laptop these buttons? If so, what values are you getting for them (on/off for webcam, switch win/fn key)?
There is a toggle for webcame on Fn+F5 and in Dragon Center. It disables the webcam.
There is a Windows key and Fn key. There is some sort of option in Dragon Center for them. I never use it, but I assume it does what all MSI laptop does.
Also, a
dmidecode
output can be useful for future improves in this module.
I am testing many different OS today, and this was generated from a Ubuntu 22.04 LTS USB live boot, if that matters at all. My previous comment was on a properly installed Ubuntu 22.04 LTS.
Ok, I need know the decimal value given when:
Path | On | Off |
---|---|---|
/sys/devices/platform/msi-ec/webcam | 9 | ? |
Path | Left | Right |
---|---|---|
/sys/devices/platform/msi-ec/win_key | ? | ? |
/sys/devices/platform/msi-ec/fn_key | ? | ? |
For example, in your first post, /sys/devices/platform/msi-ec/webcam returns 9 when is enabled, right? Also, you can test them easily editing the constant.h file and recompiling the module.
Camera off:
$ cat /sys/devices/platform/msi-ec/webcam
unknown (9)
Camera on:
$ cat /sys/devices/platform/msi-ec/webcam
unknown (75)
I am actually not sure what the win/fn key switch is doing. It seems right now all the keys on my keyboard is doing what it is labelled to do, so whatever the "default" is. The bottom row of my key board is: ctrl, win, alt, space, \, alt, fn, ctrl, left arrow, bottom arrow, right arrow
. In this state I have:
$ cat /sys/devices/platform/msi-ec/win_key
unknown (40)
$ cat /sys/devices/platform/msi-ec/fn_key
unknown (40)
Is there anyway I can toggle this function in Linux? For the camera I could do Fn+F6.
Change the constants for the webcam to:
#define MSI_EC_WEBCAM_ON 0x9
#define MSI_EC_WEBCAM_OFF 0x4b
Compile it and try it:
echo on > /sys/devices/platform/msi-ec/webcam
echo off > /sys/devices/platform/msi-ec/webcam
Win and Fn key should be swappable from Dragon Center/Bios settings. But if you don't find this option, maybe it won't be available for laptop model.
Win and Fn key should be swappable from Dragon Center/Bios settings. But if you don't find this option, maybe it won't be available for laptop model.
Normal default behavior, Windows on the left, Fn on the right:
$ for f in /sys/devices/platform/msi-ec/*_key; do echo $f; cat $f; echo; done
/sys/devices/platform/msi-ec/fn_key
unknown (40)
/sys/devices/platform/msi-ec/win_key
unknown (40)
In Windows Dragon Center, swap Win and FN keys (Fn on left side of spacebar, Win on right side), reboot into Ubuntu.
/sys/devices/platform/msi-ec/fn_key
unknown (56)
/sys/devices/platform/msi-ec/win_key
unknown (56)
Then reboot into Windows, keeping the swap, disable Win key, which I am quite sure took effect in Windows (couldn't open the start menu). Then reboot into Ubuntu, the Win key still works in Ubuntu, msi-ec
values doesn't change.
/sys/devices/platform/msi-ec/fn_key
unknown (56)
/sys/devices/platform/msi-ec/win_key
unknown (56)
Finally, reboot into Windows, removing the swap (back to original), disable Win key, which again took effect in Windows. Then reboot into Ubuntu, the Win key still works in Ubuntu:
/sys/devices/platform/msi-ec/fn_key
unknown (40)
/sys/devices/platform/msi-ec/win_key
unknown (40)
So it looks like decimal 40 is default behavior. Decimal 56 for both means swap. No way to disable Win key in Linux (why does anyone want this anyways...)?
I didn't find anything relevant in BIOS.
Change the constants for the webcam to:
#define MSI_EC_WEBCAM_ON 0x9 #define MSI_EC_WEBCAM_OFF 0x4b
I did:
#define MSI_EC_WEBCAM_ON 0x09 // 0x4a
#define MSI_EC_WEBCAM_OFF 0x4b // 0x48
then make
and sudo make install
Webcam disabled:
$ cat /sys/devices/platform/msi-ec/webcam
unknown (8)
Webcam enabled:
$ cat /sys/devices/platform/msi-ec/webcam
unknown (10)
I changed it to
#define MSI_EC_WEBCAM_ON 0x0a // 0x4a
#define MSI_EC_WEBCAM_OFF 0x08 // 0x48
and then make
and sudo make install
, but got the exact same output unknown (8)
and unknown (10)
.
During make
it says: Skipping BTF generation for /home/USERNAME/Documents/msi-ec/msi-ec.ko due to unavailability of vmlinux
if it means anything.
The module seems the previous one. Uninstall it and clear the staging folder before repeating the steps.
The module seems the previous one. Uninstall it and clear the staging folder before repeating the steps.
OK I ran sudo make uninstall
first and now it works.
#define MSI_EC_WEBCAM_ON 0x0a // 0x4a
#define MSI_EC_WEBCAM_OFF 0x08 // 0x48
$ cat /sys/devices/platform/msi-ec/webcam
off
$ cat /sys/devices/platform/msi-ec/webcam
on
I wonder maybe only the last byte matters though. Do you think it is just a coincidence that my MSI_EC_WEBCAM_ON
and MSI_EC_WEBCAM_OFF
ends in the same byte as your original?
In both cases, the address is correct, but the value is slightly different. It seems that the same address is shared and only a bit of the value is needed.
Webcam-On | 7-bit | 6-bit | 5-bit | 4-bit | 3-bit | 2-bit | 1-bit | 0-bit |
---|---|---|---|---|---|---|---|---|
0xa | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
0 |
0x4a | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
0 |
Webcam-Off | 7-bit | 6-bit | 5-bit | 4-bit | 3-bit | 2-bit | 1-bit | 0-bit |
---|---|---|---|---|---|---|---|---|
0x8 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
0 |
0x48 | 0 | 1 | 0 | 0 | 1 | 0 | 0 |
0 |
Win-Key-L | 7-bit | 6-bit | 5-bit | 4-bit | 3-bit | 2-bit | 1-bit | 0-bit |
---|---|---|---|---|---|---|---|---|
0x38 (56) | 0 | 0 | 1 | 1 |
1 | 0 | 0 | 0 |
0x50 | 0 | 1 | 0 | 1 |
0 | 0 | 0 | 0 |
Win-Key-R | 7-bit | 6-bit | 5-bit | 4-bit | 3-bit | 2-bit | 1-bit | 0-bit |
---|---|---|---|---|---|---|---|---|
0x28 (40) | 0 | 0 | 1 | 0 |
1 | 0 | 0 | 0 |
0x40 | 0 | 1 | 0 | 0 |
0 | 0 | 0 | 0 |
I must refactor the code to support bitwise operations because I have already seen the same problem with other laptop models. Thanks for your help!
Any other wrong value pending to review?
Yes bitwise (instead of byte) was what I was thinking of. Again I have no idea how these kernel/drivers work, but that was my thought.
I think I am happy with the web cam value.
It sounds like maybe my model has a different set of fn and win key options available in Dragon Center, but honestly selfishly speaking I don't really care about that option.
If you wish to clean the repo up a bit I think this issue can be closed.
Again thank you for your generous contribution. Sorry for the delay in replying.
Hello everyone, I have same model of laptop with Fedora on it. Try to do same thing and getting this error. I just starting to use linux, try to disable Secure Boot and still not worked. Tried to sign module msi-ec.ko, but still dont work. ERROR: could not insert 'msi_ec': Operation not supported
Hi I just want to open this thank you for all of your efforts, including the summary at: https://github.com/YoyPa/isw/issues/263#issuecomment-1165245973
I am not familiar with Linux kernels. I
make install
ed your repo and it was surprisingly effortless in just a few seconds. Model: GF65 Thin 10UEHere are my results:
I have not dare writing to them yet. Again I have a bit of experience with Linux, but to double check: If I want to set a setting do I just "write" to the file (
echo > ...
or using a Python script), right?Anything else I can help?