diff --git a/README.md b/README.md index 01ac7bb..056ea05 100644 --- a/README.md +++ b/README.md @@ -291,11 +291,19 @@ This is an example output: [D] core 0 thermal status: reading valid = 1 ..... ``` + +## Autoreload +Auto reload config on changes (unless it's deleted) can be enabled/disabled in the config + +``` +[General] +Autoreload = True +``` + ## A word about manufacturer provided tooling Tools provided by your notebook manufacturer like [Dell Power Manager](https://www.dell.com/support/contents/us/en/04/article/product-support/self-support-knowledgebase/software-and-downloads/dell-power-manager) tend to persist their settings to the system board. If you ever had it running under Windows and activated a cool/quiet/silent/saving profile, this setting will still be active when running linux, throttling your system. > On my Dell Latitude 5591, not even a BIOS reset to manufacturar default killed the active `Quiet` profile - ## Disclaimer This script overrides the default values set by Lenovo. I'm using it without any problem, but it is still experimental so use it at your own risk. diff --git a/etc/lenovo_fix.conf b/etc/lenovo_fix.conf index 9082579..6821fa0 100644 --- a/etc/lenovo_fix.conf +++ b/etc/lenovo_fix.conf @@ -3,6 +3,8 @@ Enabled: True # SYSFS path for checking if the system is running on AC power Sysfs_Power_Path: /sys/class/power_supply/AC*/online +# Auto reload config on changes +Autoreload: True ## Settings to apply while connected to Battery power [BATTERY] diff --git a/lenovo_fix.py b/lenovo_fix.py index d406c32..5437254 100755 --- a/lenovo_fix.py +++ b/lenovo_fix.py @@ -569,7 +569,8 @@ def power_thread(config, regs, exit_event): mchbar_mmio = None next_hwp_write = 0 - last_config_write_time = get_config_write_time() + last_config_write_time = get_config_write_time() \ + if config.getboolean('GENERAL', 'Autoreload', fallback=False) else None while not exit_event.is_set(): # log thermal status if args.debug: @@ -578,11 +579,12 @@ def power_thread(config, regs, exit_event): for key, value in core_thermal_status.items(): log('[D] core {} thermal status: {} = {}'.format(index, key.replace("_", " "), value)) - # Reload config when modified (unless it no longer exists) - config_write_time = get_config_write_time() - if config_write_time and last_config_write_time != config_write_time: - last_config_write_time = config_write_time - config, regs = reload_config() + # Reload config on changes (unless it's deleted) + if config.getboolean('GENERAL', 'Autoreload', fallback=False): + config_write_time = get_config_write_time() + if config_write_time and last_config_write_time != config_write_time: + last_config_write_time = config_write_time + config, regs = reload_config() # switch back to sysfs polling if power['method'] == 'polling':