Merge pull request #755 from mrhpearson/fix_thinkpad_fn_keys
Fix thinkpad_function_keys feature
This commit is contained in:
commit
e3ddece936
3 changed files with 6 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
# The default PPD profile
|
||||
default=balanced
|
||||
battery_detection=true
|
||||
sysfs_acpi_monitor=true
|
||||
|
||||
[profiles]
|
||||
# PPD = TuneD
|
||||
|
|
|
|||
Loading…
Reference in a new issue