aymanbagabas / Huawei-WMI

Huawei WMI laptop extras linux driver
GNU General Public License v2.0
229 stars 15 forks source link

charge_control_thresholds `0 0` #80

Open SandaruKasa opened 1 year ago

SandaruKasa commented 1 year ago

Specs

I'm running Arch Linux (kernel 6.4.12-arch1-1) on an AMD Matebook 16 (HVY-WXX9). I have the da28d6c revision of the huawei-wmi kernel module installed through dkms.

Describe the bug

/sys/devices/platform/huawei-wmi/charge_control_thresholds occasionally reports 0 0 as its value. It has essentially the same meaning as 0 100 with one small difference: it is possible to write 0 100 back, while trying to write 0 0 gives an error. This causes some things like the matebook applet or this service to fail, because they all assume writing back whatever was read from the file will always succeed (unless the user lacks permissions).

To Reproduce

Turn the laptop off and unplug the charger for a couple of hours.

Expected behavior

Either accepting 0 0 as a valid input or reporting 0 100 instead of 0 0 in the first place.