johnfanv2 / LenovoLegionLinux

Driver and tools for controlling Lenovo Legion laptops in Linux including fan control and power mode.
https://github.com/johnfanv2/LenovoLegionLinux
GNU General Public License v2.0
1.52k stars 55 forks source link

Use timer and unix_socket to run legion-linux.service #179

Closed st0nie closed 6 months ago

st0nie commented 6 months ago

legion.pdf

CC @MrDuartePT

It will solve some problems such as run legion-linux.service freqently and hit the limit set by systemd And resume from suspend and AC adapter will be easier to run fancurve-set (racing free)

For example, a plasma user config plasma -- setting ppd to powersaver when AC plug off, and his previous profile is powersaver

With the original model

  1. legion.path not run fancurve-set
  2. acpid want to run fancurve-set

When he plug in the AC

1.legion.path want to run fancurve-set 2.acpid want to run fancurve-set

Obviously here is a race running

This model:

plug off:

1.legion.path not send request 2.acpid send request to legiond

after 3s , fancurve-set is done

plug in:

1.legion.path send request, timer create 2.acpid send request to legiond , timer reset

after 3s , fancurve-set is done

I found this race condition Cuz I noticed thats after I plug in my AC adapter, my ryzenadj modifycation lost

st0nie commented 6 months ago

And it will make legion-linux.service more like a service

st0nie commented 6 months ago

It is better than now when user press fn+q freqently