jertel/p37-ec

Could not modify value of the registers

Closed this issue · 6 comments

Machine: Aero 15 WB
System: Manjaro


Hi, bro, thanks for your great work very much! I could now get to see all values of my EC registers with sudo ./p37-ec:

Usage: sudo ./p37-ec [<hex-offset[.bit]> <hex-value>]
   Ex: sudo ./p37-ec 0x01.6 0x07

Current Embedded Controller Values:
  USB Charge During Sleep     [0x01.5]: 0
  USB Charge During Hibernate [0x07.2]: 0
  Camera Enabled              [0x01.6]: 1
  Bluetooth Enabled           [0x01.7]: 1
  WiFi Enabled                [0x02.6]: 1
  Touchpad Enabled            [0x03.5]: 1
  Ambient Light               [0x66]:   0%
  Screen Enabled              [0x09.3]: 0
  Keyboard Backlight Mode     [0xD7]:   0
  CPU Temp                    [0x60]:   40 C
  GPU Temp                    [0x61]:   0 C
  MLB Temp                    [0x62]:   40 C
  Fan0 Speed                  [0xFC]:   2272 RPM
  Fan1 Speed                  [0xFE]:   2398 RPM
  Fan Control Enabled         [0x13.3]: 1
  Fan Quiet Mode Enabled      [0x08.6]: 0
  Fan Gaming Mode Enabled     [0x12.4]: 1
  Fan Custom Mode Enabled     [0x13.0]: 0
  Fan0 Custom Speed Setting   [0xB0]:   22%
  Fan1 Custom Speed Setting   [0xB1]:   22%
  Current Speed Setting       [0x64]:   0

But it seems I could not modify the values. I tried sudo ./p37-ec 0x01.6 0x00, sudo ./p37-ec 0x08.6 0x07, sudo ./p37-ec 0xB0 0x07, but nothing changed 😅 I also tried the command sudo modprobe ec_sys write_support=1, but still nothing changed.

Is my operation wrong? BTW, is 0x07 the maximum value of a register?

Not all registers are writable. For example, you can't write to a temperature register, and even some registers that look like they should be writable actually are read-only. Each laptop model could have a different version of the embedded controller, so even though a register might have been labeled as Camera Enabled on my 2015 Gigabyte P37xv5, on a newer 2020 model that register could be for something completely different. This program was written specifically for the P37's. I don't have a newer laptop to verify the registers against.

Also, the max value for a register is 255 (decimal) or 0xFF (hex). But if you're changing a specific bit then the value can only be a 0 or a 1. So my usage example above, sudo ./p37-ec 0x01.6 0x07 is misleading since you can't expect a bit to have a value of 7, since bits are either on (1) or off (0). Any value greater than 0 will be interpreted as a 1 so you can still specify 0x07, it doesn't hurt anything.

Alright, then could you suggest any helpful documents or methods to figure out what the registers are for?

Unfortunately, you will likely have to use trial and error to discover if any bits or registers have changed. I was unable to find documentation for the P37's several years ago. Perhaps something has been published since then - you'll have to search Google for it, if it exists. Otherwise it's a slow process to figure out which registers are associated to different laptop functions.

image
I have the XB, and some registers are definitely wrong because I have not disabled the camera. I'll try finding the right ones and post the results here.

Alright, here's my results:
r.txt

Understood. Thank you for your kind explanation!