BeardOverflow / msi-ec

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

A few sysfs paths answer me with a unknown value #2

Closed BeardOverflow closed 1 year ago

BeardOverflow commented 1 year ago

just a little feed back. Don't get me wrong this is awesome.

cat /sys/devices/platform/msi-ec/webcam
File: /sys/devices/platform/msi-ec/webcam
unknown (75)

cat /sys/devices/platform/msi-ec/fn_key
File: /sys/devices/platform/msi-ec/fn_key
unknown (0)

cat /sys/devices/platform/msi-ec/win_key
File: /sys/devices/platform/msi-ec/win_key
unknown (0)

cat /sys/devices/platform/msi-ec/battery_mode
File: /sys/devices/platform/msi-ec/battery_mode
medium

cat /sys/devices/platform/msi-ec/fan_mode
File: /sys/devices/platform/msi-ec/fan_mode
unknown (12)

Working just some information
cat /sys/devices/platform/msi-ec/fw_version
File: /sys/devices/platform/msi-ec/fw_version
16U5EMS1.100

Working just some information
cat /sys/devices/platform/msi-ec/fw_release_date
File: /sys/devices/platform/msi-ec/fw_release_date
2019/06/25 10:24:07

The rest is all working like it should. Super impressed.

Originally posted by @fawqsir in https://github.com/BeardOverflow/msi-ec/issues/1#issuecomment-1185133202

BeardOverflow commented 1 year ago

Your embedded controller has different constants. Some of them can be easily fixable by editing the constants.h file. For example:

cat /sys/devices/platform/msi-ec/webcam
unknown (75)

Convert the value to hexadecimal (I must improve the error message, sorry), press Fn+6 in your keyboard (camera switching), annotate the new value. Go to the constants file and edit it with the new values:

#define MSI_EC_WEBCAM_ON 0x4b
#define MSI_EC_WEBCAM_OFF 0x49

That's all.

I am sorry, currently I have no time to continue developing. The module should detect your embedded controller version and should handle several constant's tables. After the summer, on October I probably able to continue improving this module.

Regards.

sainak commented 1 year ago

The actual value can be obtained by masking the value from ec for example the mask for camera is 0x2 so doing value & 0x2 gives the actual value, same can be done for other attributes I'm using this logic in #3 to get appropriate state of leds regardless of the constant value. Though there are a few caveats to writing the data to ec, I was able to find an issue writing state value less than 0x80 wont turn on the backlight, though the state was changing (the brightness), I suspect the kb address requires the 7th lsb to be 1 (0b10000001) to light up the led.