1
0
Fork 0

Merge pull request #755 from mrhpearson/fix_thinkpad_fn_keys

Fix thinkpad_function_keys feature
This commit is contained in:
Jaroslav Škarvada 2025-07-24 00:49:23 +02:00 committed by GitHub
commit e3ddece936
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -11,7 +11,7 @@ PROFILES_SECTION = "profiles"
BATTERY_SECTION = "battery"
DEFAULT_PROFILE_OPTION = "default"
BATTERY_DETECTION_OPTION = "battery_detection"
THINKPAD_FUNCTION_KEYS_OPTION = "thinkpad_function_keys"
SYSFS_ACPI_MONITOR_OPTION = "sysfs_acpi_monitor"
class ProfileMap:
@ -75,13 +75,13 @@ class PPDConfig:
return self._tuned_to_ppd
@property
def thinkpad_function_keys(self):
def sysfs_acpi_monitor(self):
"""
Whether to react to changes of ACPI platform profile
done via function keys (e.g., Fn-L) on newer Thinkpad
machines. Experimental feature.
"""
return self._thinkpad_function_keys
return self._sysfs_acpi_monitor
def load_from_file(self, config_file):
"""
@ -141,4 +141,4 @@ class PPDConfig:
self._ppd_to_tuned = ProfileMap(profile_dict_ac, profile_dict_dc)
self._tuned_to_ppd = ProfileMap({v: k for k, v in profile_dict_ac.items()}, {v: k for k, v in profile_dict_dc.items()})
self._thinkpad_function_keys = cfg.getboolean(MAIN_SECTION, THINKPAD_FUNCTION_KEYS_OPTION, fallback=False)
self._sysfs_acpi_monitor = cfg.getboolean(MAIN_SECTION, SYSFS_ACPI_MONITOR_OPTION, fallback=True)

View file

@ -304,7 +304,7 @@ class Controller(exports.interfaces.ExportableInterface):
self._inotify_watches |= self._watch_manager.add_watch(path=os.path.dirname(LAP_MODE_PATH),
mask=pyinotify.IN_MODIFY,
proc_fun=PerformanceDegradedEventHandler(self, LAP_MODE_PATH))
if self._platform_profile_supported and self._config.thinkpad_function_keys:
if self._platform_profile_supported and self._config.sysfs_acpi_monitor:
self._pinned_virtual_files.append(open(PLATFORM_PROFILE_PATH, "r"))
self._inotify_watches |= self._watch_manager.add_watch(path=os.path.dirname(PLATFORM_PROFILE_PATH),
mask=pyinotify.IN_OPEN | pyinotify.IN_MODIFY | pyinotify.IN_CLOSE_WRITE | pyinotify.IN_CLOSE_NOWRITE,

View file

@ -2,6 +2,7 @@
# The default PPD profile
default=balanced
battery_detection=true
sysfs_acpi_monitor=true
[profiles]
# PPD = TuneD