Hello community,
here is the log from the commit of package laptop-mode-tools for
openSUSE:Factory checked in at 2020-05-26 17:19:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/laptop-mode-tools (Old)
and /work/SRC/openSUSE:Factory/.laptop-mode-tools.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "laptop-mode-tools"
Tue May 26 17:19:04 2020 rev:42 rq:807970 version:1.73.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/laptop-mode-tools/laptop-mode-tools.changes
2020-02-04 19:57:13.353457006 +0100
+++
/work/SRC/openSUSE:Factory/.laptop-mode-tools.new.2738/laptop-mode-tools.changes
2020-05-26 17:19:13.879963324 +0200
@@ -1,0 +2,22 @@
+Tue May 12 11:50:51 UTC 2020 - Paolo Stivanin <[email protected]>
+
+- Update to 1.73.1:
+ * Respect black/white lists when disabling autosuspend
+ * Add newer power supply names
+ * Fix crash due external battery of mouse
+ * Honor configuration setting for battery level polling
+ * cpufreq: intel_pstate should use performance governors
+ * runtime-pm: Speed up by avoiding fork in echo_to_file
+ * runtime-pm: Inline echo_to_file_do
+ * runtime-pm: Fix echo_to_file* indentation
+ * runtime-pm: Speed up by avoiding fork in listed_by_{id,type}
+ * runtime-pm: Simplify vendor/product match
+ * add help and verison user commands
+ * Add a power-stats status command
+ * Separate power sysfs attributes and add sysfs status attribute
+ * Add device type 'sd' to default blacklist
+ * Fix rpm spec file for new installable files
+ * Return the cpu governor string from the function
+- Remove laptop-mode-tools-1.72.2-fix-name-gui.patch
+
+-------------------------------------------------------------------
Old:
----
laptop-mode-tools-1.72.2-fix-name-gui.patch
laptop-mode-tools-1.72.2.tar.gz
New:
----
laptop-mode-tools-1.73.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ laptop-mode-tools.spec ++++++
--- /var/tmp/diff_new_pack.tChoKw/_old 2020-05-26 17:19:14.683965053 +0200
+++ /var/tmp/diff_new_pack.tChoKw/_new 2020-05-26 17:19:14.687965061 +0200
@@ -20,7 +20,7 @@
%{!?_udevdir:%global _udevdir %{_libexecdir}/udev}
Name: laptop-mode-tools
-Version: 1.72.2
+Version: 1.73.1
Release: 0
Summary: The Laptop Mode Tools
License: GPL-2.0-or-later
@@ -31,8 +31,6 @@
Patch0: laptop-mode-1.53_conf.diff
Patch1: laptop-mode-1.49-new-dirty-ratio-defaults.diff
Patch2: laptop-mode-1.53-moblin-enable-intel-hda-powersave.patch
-# PATCH-FIX-UPSTREAM laptop-mode-tools-1.72.2-fix-name-gui.patch --
gh#rickysarraf/laptop-mode-tools#124
-Patch3: laptop-mode-tools-1.72.2-fix-name-gui.patch
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
++++++ laptop-mode-tools-1.72.2.tar.gz -> laptop-mode-tools-1.73.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/.github/ISSUE_TEMPLATE/laptop-mode-tools-bug-report.md
new/laptop-mode-tools-1.73.1/.github/ISSUE_TEMPLATE/laptop-mode-tools-bug-report.md
---
old/laptop-mode-tools-1.72.2/.github/ISSUE_TEMPLATE/laptop-mode-tools-bug-report.md
1970-01-01 01:00:00.000000000 +0100
+++
new/laptop-mode-tools-1.73.1/.github/ISSUE_TEMPLATE/laptop-mode-tools-bug-report.md
2020-01-11 12:47:05.000000000 +0100
@@ -0,0 +1,35 @@
+---
+name: Laptop Mode Tools Bug Report
+about: Laptop Mode Tools Bug Report
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Important Information:**
+ - Distribution
+ - Linux Kernel
+ - Laptop Mode Tools version
+ - Desktop Environment, if any
+ - Relevant System Logs
+ - Laptop Mode Tools verbose logs
+
+**Additional context**
+Add any other context about the problem here.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/Documentation/revision-history.txt
new/laptop-mode-tools-1.73.1/Documentation/revision-history.txt
--- old/laptop-mode-tools-1.72.2/Documentation/revision-history.txt
2018-02-03 17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/Documentation/revision-history.txt
2020-01-11 12:47:05.000000000 +0100
@@ -1,3 +1,20 @@
+1.73 - Sat Jan 11 14:52:11 IST 2020
+ * Respect black/white lists when disabling autosuspend
+ * Add newer power supply names
+ * Fix crash due external battery of mouse
+ * Honor configuration setting for battery level polling
+ * cpufreq: intel_pstate should use performance governors
+ * runtime-pm: Speed up by avoiding fork in echo_to_file
+ * runtime-pm: Inline echo_to_file_do
+ * runtime-pm: Fix echo_to_file* indentation
+ * runtime-pm: Speed up by avoiding fork in listed_by_{id,type}
+ * runtime-pm: Simplify vendor/product match
+ * add help and verison user commands
+ * Add a power-stats status command
+ * Separate power sysfs attributes and add sysfs status attribute
+ * Add device type 'sd' to default blacklist
+ * Fix rpm spec file for new installable files
+
1.72 - Thu Feb 1 21:59:24 IST 2018
* Switch to PyQt5 and Python3
* Add btrfs to list of filesystems for which we can set commit interval
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/etc/laptop-mode/conf.d/cpufreq.conf
new/laptop-mode-tools-1.73.1/etc/laptop-mode/conf.d/cpufreq.conf
--- old/laptop-mode-tools-1.72.2/etc/laptop-mode/conf.d/cpufreq.conf
2018-02-03 17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/etc/laptop-mode/conf.d/cpufreq.conf
2020-01-11 12:47:05.000000000 +0100
@@ -40,22 +40,25 @@
# "medium" for some value in the middle, or any value listed in
# /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies.
# The "governor" can be any governor installed on your system, this usually
-# includes "ondemand", "conservative", and "performance". The
-# "IGNORE_NICE_LOAD" setting specifies that background programs that have
+# includes "ondemand", "conservative", and "performance". And it can also be
+# a speical value "auto" which is the default case meaning that the governor
+# is picked automatically by LMT, that is try to use governors provided by
+# intel_pstate driver first and fallback to ondemand if that's not possible.
+# The "IGNORE_NICE_LOAD" setting specifies that background programs that have
# a low priority ("nice level") should not cause the CPU frequency to
# be increased. (You generally want this to be enabled in battery mode.)
#
BATT_CPU_MAXFREQ=fastest
BATT_CPU_MINFREQ=slowest
-BATT_CPU_GOVERNOR=ondemand
+BATT_CPU_GOVERNOR=auto
BATT_CPU_IGNORE_NICE_LOAD=1
LM_AC_CPU_MAXFREQ=fastest
LM_AC_CPU_MINFREQ=slowest
-LM_AC_CPU_GOVERNOR=ondemand
+LM_AC_CPU_GOVERNOR=auto
LM_AC_CPU_IGNORE_NICE_LOAD=1
NOLM_AC_CPU_MAXFREQ=fastest
NOLM_AC_CPU_MINFREQ=slowest
-NOLM_AC_CPU_GOVERNOR=ondemand
+NOLM_AC_CPU_GOVERNOR=auto
NOLM_AC_CPU_IGNORE_NICE_LOAD=0
@@ -63,7 +66,7 @@
# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
-#
+#
# This is only useful on older P4 processors that do not support frequency
# scaling. On such processors, this is the only way to reduce power consumption
# but at the cost of higher performance penalty.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/etc/laptop-mode/conf.d/runtime-pm.conf
new/laptop-mode-tools-1.73.1/etc/laptop-mode/conf.d/runtime-pm.conf
--- old/laptop-mode-tools-1.72.2/etc/laptop-mode/conf.d/runtime-pm.conf
2018-02-03 17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/etc/laptop-mode/conf.d/runtime-pm.conf
2020-01-11 12:47:05.000000000 +0100
@@ -55,7 +55,7 @@
# Example: AUTOSUSPEND_RUNTIME_DEVTYPE_WHITELIST="usbhid usb-storage"
AUTOSUSPEND_RUNTIME_DEVTYPE_WHITELIST=""
-# Trigger auto-suspension of the deivce under conditional circumstances
+# Trigger auto-suspension of the device under conditional circumstances
# Warning: DO NOT CHANGE THESE DEFAUTLS UNLESS YOU KNOW
BATT_SUSPEND_RUNTIME=1
LM_AC_SUSPEND_RUNTIME=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/etc/rules/99-laptop-mode.rules
new/laptop-mode-tools-1.73.1/etc/rules/99-laptop-mode.rules
--- old/laptop-mode-tools-1.72.2/etc/rules/99-laptop-mode.rules 2018-02-03
17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/etc/rules/99-laptop-mode.rules 2020-01-11
12:47:05.000000000 +0100
@@ -1,4 +1,4 @@
-ACTION=="change", SUBSYSTEM=="power_supply",
ENV{POWER_SUPPLY_NAME}=="|AC|ACAD", RUN+="lmt-udev auto"
+ACTION=="change", SUBSYSTEM=="power_supply",
ENV{POWER_SUPPLY_NAME}=="|AC|ACAD|ADP*", RUN+="lmt-udev auto"
ACTION=="add|remove", SUBSYSTEM=="machinecheck", RUN+="lmt-udev auto"
ACTION=="add", SUBSYSTEM=="usb", RUN+="lmt-udev force"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/etc/systemd/lmt-poll.service
new/laptop-mode-tools-1.73.1/etc/systemd/lmt-poll.service
--- old/laptop-mode-tools-1.72.2/etc/systemd/lmt-poll.service 2018-02-03
17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/etc/systemd/lmt-poll.service 2020-01-11
12:47:05.000000000 +0100
@@ -6,8 +6,10 @@
[Service]
Type=oneshot
RemainAfterExit=no
-ExecStart=/lib/udev/lmt-udev auto
-ExecReload=/lib/udev/lmt-udev auto
+Environment=CONTROL_BATTERY_LEVEL_POLLING=1
+EnvironmentFile=-/etc/laptop-mode/conf.d/battery-level-polling.conf
+ExecStart=-/bin/sh -c '[ x"$CONTROL_BATTERY_LEVEL_POLLING" = "x1" ] &&
/lib/udev/lmt-udev auto || echo "laptop-mode: Battery polling disabled"'
+ExecReload=-/bin/sh -c '[ x"$CONTROL_BATTERY_LEVEL_POLLING" = "x1" ] &&
/lib/udev/lmt-udev auto || echo "laptop-mode: Battery polling disabled"'
StandardOutput=journal
StandardError=journal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/laptop-mode-tools-1.72.2/gui/LMT.py
new/laptop-mode-tools-1.73.1/gui/LMT.py
--- old/laptop-mode-tools-1.72.2/gui/LMT.py 2018-02-03 17:08:43.000000000
+0100
+++ new/laptop-mode-tools-1.73.1/gui/LMT.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,262 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-
-""" Laptop Mode Tools """
-
-
-import sys
-from getpass import getuser
-from os import access, F_OK, geteuid, listdir, path, putenv
-from shutil import move
-from webbrowser import open_new_tab
-
-from PyQt5.QtWidgets import (QWidget, QMessageBox, QVBoxLayout, QHBoxLayout,
- QGroupBox, QScrollArea, QCheckBox, QPushButton,
- QApplication, QMainWindow, QDialogButtonBox,
- QGraphicsDropShadowEffect, QShortcut)
-from PyQt5.QtGui import (QIcon, QColor)
-
-
-# This seems to be needed, atleast of Debian
-putenv('QT_X11_NO_MITSHM', "1")
-
-# constants
-COMMENT_IDENTIFIER = "#__COMMENT"
-CONTROL_IDENTIFIER = "CONTROL_"
-CONFIG_DIR = "/etc/laptop-mode/conf.d"
-WEBPAGE_URL = "http://github.com/rickysarraf/laptop-mode-tools"
-
-
-###############################################################################
-
-
-class Log():
- def debug(self, string_to_log):
- sys.stderr.write(string_to_log + "\n")
-
- def msg(self, string_to_log):
- sys.stdout.write(string_to_log + "\n")
-
- def err(self, string_to_log):
- sys.stderr.write(string_to_log + "\n")
-
-
-class MainWidget(QMainWindow):
- def __init__(self, parent=None):
- QMainWindow.__init__(self, parent)
- self.configOptions, self.checkBoxList, self.configBool = {}, {}, None
- # Check for root privileges
- if geteuid() != 0:
- msg = ("{} is not root. You need to run with root priviliges\n"
- "Please use kdesudo, gksu or sudo/sux.").format(getuser())
- QMessageBox.critical(self, __doc__ + "- Error", msg)
- sys.exit(1)
- else:
- msg = "This tool is running with root priviliges."
- QMessageBox.warning(self, __doc__ + "- Warning", msg)
- # title, icon and sizes
- self.setWindowTitle(__doc__)
- self.setMinimumSize(400, 400)
- self.setMaximumSize(2048, 2048)
- self.resize(600, 600)
- self.setWindowIcon(QIcon.fromTheme("preferences-system"))
- self.menuBar().addMenu("&File").addAction("Exit", exit)
- QShortcut("Ctrl+q", self, activated=lambda: self.close())
- # main group
- main_group = QGroupBox("Module configuration")
- self.setCentralWidget(main_group)
- self.layout = QVBoxLayout(main_group)
- # scrollarea widgets
- self.scrollArea, self.window = QScrollArea(), QWidget()
- self.layout.addWidget(self.scrollArea)
- self.vbox = QVBoxLayout(self.window)
- # Graphic effect
- glow = QGraphicsDropShadowEffect(self)
- glow.setOffset(0)
- glow.setBlurRadius(99)
- glow.setColor(QColor(99, 255, 255))
- self.scrollArea.setGraphicsEffect(glow)
- glow.setEnabled(True)
- # config loading stuff
- self.findConfig(CONFIG_DIR)
- for eachOption in tuple(self.configOptions.keys()):
-
- self.readConfig(eachOption, self.configOptions)
- self.subLayout = QHBoxLayout()
-
- self.checkBoxName = "checkBox_" + eachOption
- checkBoxList = QCheckBox(self.checkBoxName, self)
- self.checkBoxList[self.checkBoxName] = checkBoxList
- checkBoxList.setObjectName(self.checkBoxName)
- checkBoxList.setText("Enable module {}".format(eachOption))
-
- if self.tooltip is not '':
- checkBoxList.setToolTip(self.tooltip)
- else:
- tooltip = "Configuration settings for {}".format(eachOption)
- checkBoxList.setToolTip(tooltip)
-
- if self.configBool:
- checkBoxList.setChecked(True)
-
- self.subLayout.addWidget(checkBoxList)
- self.vbox.addLayout(self.subLayout)
- self.scrollArea.setWidget(self.window)
-
- # Bottom Buttons Bar
- self.pushButtonSleep = QPushButton("Sleep")
- self.pushButtonSleep.setToolTip("Trigger Suspend to RAM aka Sleep")
- self.pushButtonSleep.clicked.connect(self.sleep)
- self.pushButtonHibernate = QPushButton("Hibernate")
- self.pushButtonHibernate.setToolTip("Trigger Suspend to Disk
Hibernate")
- self.pushButtonHibernate.clicked.connect(self.hibernate)
- self.buttonBox = QDialogButtonBox()
- self.buttonBox.setStandardButtons(
- QDialogButtonBox.Ok | QDialogButtonBox.Close |
- QDialogButtonBox.Help)
- self.buttonBox.addButton(self.pushButtonHibernate,
- QDialogButtonBox.ActionRole)
- self.buttonBox.addButton(self.pushButtonSleep,
- QDialogButtonBox.ActionRole)
- self.layout.addWidget(self.buttonBox)
- self.buttonBox.rejected.connect(exit)
- self.buttonBox.accepted.connect(self.writeConfig)
- self.buttonBox.helpRequested.connect(lambda: open_new_tab(WEBPAGE_URL))
-
- def closeEvent(self, event):
- ' Ask to Quit '
- the_conditional_is_true = QMessageBox.question(
- self, __doc__.title(), 'Quit ?.', QMessageBox.Yes | QMessageBox.No,
- QMessageBox.No) == QMessageBox.Yes
- event.accept() if the_conditional_is_true else event.ignore()
-
- def sleep(self):
- """Method to make the computer Sleep."""
- try:
- sysfsFP = open("/sys/power/state", 'w')
- except:
- log.err("Couldn't open kernel interface")
- return False
- else:
- try:
- sysfsFP.write("mem")
- except:
- log.err("Couldn't write to kernel interface")
- return False
-
- def hibernate(self):
- """Method to make the computer Hibernate."""
- try:
- sysfsFP = open("/sys/power/state", 'w')
- except:
- log.err("Couldn't open kernel interface")
- return False
- else:
- try:
- sysfsFP.write("disk")
- except:
- log.err("Couldn't write to kernel interface")
- return False
-
- def writeConfig(self):
- """Method to get a configuration for the App."""
- finalResult = True
- for eachWriteOption in tuple(self.configOptions.keys()):
- checkBoxName = "checkBox_" + eachWriteOption
- if self.checkBoxList[checkBoxName].isChecked() is True:
- val = 1
- else:
- val = 0
- ret = self.populateValues(self.configOptions[eachWriteOption], val)
-
- if ret is False:
- log.debug("Couldn't apply setting for %s" % checkBoxName)
- finalResult = False
-
- if finalResult is False:
- QMessageBox.critical(self, "Error",
- "Couldn't apply all requested settings")
- else:
- QMessageBox.information(self, "Success",
- "Applied all requested settings")
-
- def populateValues(self, _path, value):
- """Method to populate values from a file path."""
- try:
- readHandle = open(_path, 'r')
- writeHandle = open(_path + ".tmp", 'w')
- for line in readHandle.readlines():
- if line.startswith(CONTROL_IDENTIFIER):
- newline = line.split("=")[0] + "=" + str(value)
- writeHandle.write(newline)
- # You need this newline, otherwise the next line gets
- # overlapped here
- writeHandle.write("\n")
- else:
- writeHandle.write(line)
- readHandle.close()
- writeHandle.close()
- move(_path + ".tmp", _path)
- return True
- except:
- log.debug("Failed in populateValues() when operating on %s" %
_path)
- return False
-
- def findConfig(self, configDir):
- """Take a configDir and find the configuration for the App."""
- if configDir is None:
- return False
-
- # TODO: Do we need to take care of the vendor specific overrides ???
- for configFile in listdir(configDir):
- if access(path.join(configDir, configFile), F_OK) is True:
- fn = path.join(configDir, configFile)
- self.configOptions[configFile.split(".")[0]] = fn
- else:
- pass
-
- def readConfig(self, key, configOptionsDict):
- """Take a key and dict and read the configurations for the App."""
- self.tooltip = ''
-
- if key is None or configOptionsDict is None:
- return False
-
- try:
- fileHandle = open(configOptionsDict[key], 'r')
- except:
- return False
-
- for line in fileHandle.readlines():
- if line.startswith(COMMENT_IDENTIFIER):
- self.tooltip = self.tooltip + line.lstrip(COMMENT_IDENTIFIER)
- elif line.startswith(CONTROL_IDENTIFIER):
- boolValue = line.split("=")[1]
- # Bloody boolValue could inherit the '\n' new line
- boolValue = boolValue.rstrip("\n")
-
- if boolValue == str(1) or "\"auto\"" in boolValue:
- self.configBool = True
- else:
- self.configBool = False
-
- # This will ensure that even if we don't read any string, tooltip
- # doesn't fail
- self.tooltip = self.tooltip + ''
-
-
-###############################################################################
-
-
-if __name__ == "__main__":
- log = Log()
- application = QApplication(sys.argv)
- application.setApplicationName(__doc__.strip().lower())
- application.setOrganizationName(__doc__.strip().title())
- application.setOrganizationDomain(__doc__.strip().title())
- application.setWindowIcon(QIcon.fromTheme("preferences-system"))
- window = MainWidget()
- window.show()
- window.raise_()
- sys.exit(application.exec_())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/laptop-mode-tools-1.72.2/gui/lmt.py
new/laptop-mode-tools-1.73.1/gui/lmt.py
--- old/laptop-mode-tools-1.72.2/gui/lmt.py 1970-01-01 01:00:00.000000000
+0100
+++ new/laptop-mode-tools-1.73.1/gui/lmt.py 2020-01-11 12:47:05.000000000
+0100
@@ -0,0 +1,262 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+
+""" Laptop Mode Tools """
+
+
+import sys
+from getpass import getuser
+from os import access, F_OK, geteuid, listdir, path, putenv
+from shutil import move
+from webbrowser import open_new_tab
+
+from PyQt5.QtWidgets import (QWidget, QMessageBox, QVBoxLayout, QHBoxLayout,
+ QGroupBox, QScrollArea, QCheckBox, QPushButton,
+ QApplication, QMainWindow, QDialogButtonBox,
+ QGraphicsDropShadowEffect, QShortcut)
+from PyQt5.QtGui import (QIcon, QColor)
+
+
+# This seems to be needed, atleast of Debian
+putenv('QT_X11_NO_MITSHM', "1")
+
+# constants
+COMMENT_IDENTIFIER = "#__COMMENT"
+CONTROL_IDENTIFIER = "CONTROL_"
+CONFIG_DIR = "/etc/laptop-mode/conf.d"
+WEBPAGE_URL = "http://github.com/rickysarraf/laptop-mode-tools"
+
+
+###############################################################################
+
+
+class Log():
+ def debug(self, string_to_log):
+ sys.stderr.write(string_to_log + "\n")
+
+ def msg(self, string_to_log):
+ sys.stdout.write(string_to_log + "\n")
+
+ def err(self, string_to_log):
+ sys.stderr.write(string_to_log + "\n")
+
+
+class MainWidget(QMainWindow):
+ def __init__(self, parent=None):
+ QMainWindow.__init__(self, parent)
+ self.configOptions, self.checkBoxList, self.configBool = {}, {}, None
+ # Check for root privileges
+ if geteuid() != 0:
+ msg = ("{} is not root. You need to run with root privileges\n"
+ "Please use kdesudo, gksu or sudo/sux.").format(getuser())
+ QMessageBox.critical(self, __doc__ + "- Error", msg)
+ sys.exit(1)
+ else:
+ msg = "This tool is running with root privileges."
+ QMessageBox.warning(self, __doc__ + "- Warning", msg)
+ # title, icon and sizes
+ self.setWindowTitle(__doc__)
+ self.setMinimumSize(400, 400)
+ self.setMaximumSize(2048, 2048)
+ self.resize(600, 600)
+ self.setWindowIcon(QIcon.fromTheme("preferences-system"))
+ self.menuBar().addMenu("&File").addAction("Exit", exit)
+ QShortcut("Ctrl+q", self, activated=lambda: self.close())
+ # main group
+ main_group = QGroupBox("Module configuration")
+ self.setCentralWidget(main_group)
+ self.layout = QVBoxLayout(main_group)
+ # scrollarea widgets
+ self.scrollArea, self.window = QScrollArea(), QWidget()
+ self.layout.addWidget(self.scrollArea)
+ self.vbox = QVBoxLayout(self.window)
+ # Graphic effect
+ glow = QGraphicsDropShadowEffect(self)
+ glow.setOffset(0)
+ glow.setBlurRadius(99)
+ glow.setColor(QColor(99, 255, 255))
+ self.scrollArea.setGraphicsEffect(glow)
+ glow.setEnabled(True)
+ # config loading stuff
+ self.findConfig(CONFIG_DIR)
+ for eachOption in tuple(self.configOptions.keys()):
+
+ self.readConfig(eachOption, self.configOptions)
+ self.subLayout = QHBoxLayout()
+
+ self.checkBoxName = "checkBox_" + eachOption
+ checkBoxList = QCheckBox(self.checkBoxName, self)
+ self.checkBoxList[self.checkBoxName] = checkBoxList
+ checkBoxList.setObjectName(self.checkBoxName)
+ checkBoxList.setText("Enable module {}".format(eachOption))
+
+ if self.tooltip is not '':
+ checkBoxList.setToolTip(self.tooltip)
+ else:
+ tooltip = "Configuration settings for {}".format(eachOption)
+ checkBoxList.setToolTip(tooltip)
+
+ if self.configBool:
+ checkBoxList.setChecked(True)
+
+ self.subLayout.addWidget(checkBoxList)
+ self.vbox.addLayout(self.subLayout)
+ self.scrollArea.setWidget(self.window)
+
+ # Bottom Buttons Bar
+ self.pushButtonSleep = QPushButton("Sleep")
+ self.pushButtonSleep.setToolTip("Trigger Suspend to RAM aka Sleep")
+ self.pushButtonSleep.clicked.connect(self.sleep)
+ self.pushButtonHibernate = QPushButton("Hibernate")
+ self.pushButtonHibernate.setToolTip("Trigger Suspend to Disk
Hibernate")
+ self.pushButtonHibernate.clicked.connect(self.hibernate)
+ self.buttonBox = QDialogButtonBox()
+ self.buttonBox.setStandardButtons(
+ QDialogButtonBox.Ok | QDialogButtonBox.Close |
+ QDialogButtonBox.Help)
+ self.buttonBox.addButton(self.pushButtonHibernate,
+ QDialogButtonBox.ActionRole)
+ self.buttonBox.addButton(self.pushButtonSleep,
+ QDialogButtonBox.ActionRole)
+ self.layout.addWidget(self.buttonBox)
+ self.buttonBox.rejected.connect(exit)
+ self.buttonBox.accepted.connect(self.writeConfig)
+ self.buttonBox.helpRequested.connect(lambda: open_new_tab(WEBPAGE_URL))
+
+ def closeEvent(self, event):
+ ' Ask to Quit '
+ the_conditional_is_true = QMessageBox.question(
+ self, __doc__.title(), 'Quit ?.', QMessageBox.Yes | QMessageBox.No,
+ QMessageBox.No) == QMessageBox.Yes
+ event.accept() if the_conditional_is_true else event.ignore()
+
+ def sleep(self):
+ """Method to make the computer Sleep."""
+ try:
+ sysfsFP = open("/sys/power/state", 'w')
+ except:
+ log.err("Couldn't open kernel interface")
+ return False
+ else:
+ try:
+ sysfsFP.write("mem")
+ except:
+ log.err("Couldn't write to kernel interface")
+ return False
+
+ def hibernate(self):
+ """Method to make the computer Hibernate."""
+ try:
+ sysfsFP = open("/sys/power/state", 'w')
+ except:
+ log.err("Couldn't open kernel interface")
+ return False
+ else:
+ try:
+ sysfsFP.write("disk")
+ except:
+ log.err("Couldn't write to kernel interface")
+ return False
+
+ def writeConfig(self):
+ """Method to get a configuration for the App."""
+ finalResult = True
+ for eachWriteOption in tuple(self.configOptions.keys()):
+ checkBoxName = "checkBox_" + eachWriteOption
+ if self.checkBoxList[checkBoxName].isChecked() is True:
+ val = 1
+ else:
+ val = 0
+ ret = self.populateValues(self.configOptions[eachWriteOption], val)
+
+ if ret is False:
+ log.debug("Couldn't apply setting for %s" % checkBoxName)
+ finalResult = False
+
+ if finalResult is False:
+ QMessageBox.critical(self, "Error",
+ "Couldn't apply all requested settings")
+ else:
+ QMessageBox.information(self, "Success",
+ "Applied all requested settings")
+
+ def populateValues(self, _path, value):
+ """Method to populate values from a file path."""
+ try:
+ readHandle = open(_path, 'r')
+ writeHandle = open(_path + ".tmp", 'w')
+ for line in readHandle.readlines():
+ if line.startswith(CONTROL_IDENTIFIER):
+ newline = line.split("=")[0] + "=" + str(value)
+ writeHandle.write(newline)
+ # You need this newline, otherwise the next line gets
+ # overlapped here
+ writeHandle.write("\n")
+ else:
+ writeHandle.write(line)
+ readHandle.close()
+ writeHandle.close()
+ move(_path + ".tmp", _path)
+ return True
+ except:
+ log.debug("Failed in populateValues() when operating on %s" %
_path)
+ return False
+
+ def findConfig(self, configDir):
+ """Take a configDir and find the configuration for the App."""
+ if configDir is None:
+ return False
+
+ # TODO: Do we need to take care of the vendor specific overrides ???
+ for configFile in listdir(configDir):
+ if access(path.join(configDir, configFile), F_OK) is True:
+ fn = path.join(configDir, configFile)
+ self.configOptions[configFile.split(".")[0]] = fn
+ else:
+ pass
+
+ def readConfig(self, key, configOptionsDict):
+ """Take a key and dict and read the configurations for the App."""
+ self.tooltip = ''
+
+ if key is None or configOptionsDict is None:
+ return False
+
+ try:
+ fileHandle = open(configOptionsDict[key], 'r')
+ except:
+ return False
+
+ for line in fileHandle.readlines():
+ if line.startswith(COMMENT_IDENTIFIER):
+ self.tooltip = self.tooltip + line.lstrip(COMMENT_IDENTIFIER)
+ elif line.startswith(CONTROL_IDENTIFIER):
+ boolValue = line.split("=")[1]
+ # Bloody boolValue could inherit the '\n' new line
+ boolValue = boolValue.rstrip("\n")
+
+ if boolValue == str(1) or "\"auto\"" in boolValue:
+ self.configBool = True
+ else:
+ self.configBool = False
+
+ # This will ensure that even if we don't read any string, tooltip
+ # doesn't fail
+ self.tooltip = self.tooltip + ''
+
+
+###############################################################################
+
+
+if __name__ == "__main__":
+ log = Log()
+ application = QApplication(sys.argv)
+ application.setApplicationName(__doc__.strip().lower())
+ application.setOrganizationName(__doc__.strip().title())
+ application.setOrganizationDomain(__doc__.strip().title())
+ application.setWindowIcon(QIcon.fromTheme("preferences-system"))
+ window = MainWidget()
+ window.show()
+ window.raise_()
+ sys.exit(application.exec_())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/laptop-mode-tools-1.72.2/install.sh
new/laptop-mode-tools-1.73.1/install.sh
--- old/laptop-mode-tools-1.72.2/install.sh 2018-02-03 17:08:43.000000000
+0100
+++ new/laptop-mode-tools-1.73.1/install.sh 2020-01-11 12:47:05.000000000
+0100
@@ -209,7 +209,7 @@
exit 11
fi
-if ( ! $INSTALL -m 644 gui/LMT.py "$DESTDIR/usr/share/laptop-mode-tools" ) ;
then
+if ( ! $INSTALL -m 644 gui/lmt.py "$DESTDIR/usr/share/laptop-mode-tools" ) ;
then
echo "$0: Failed to install
$DESTDIR/usr/share/laptop-mode-tools/lmt.py";
exit 11
fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/laptop-mode-tools-1.72.2/laptop-mode-tools.spec
new/laptop-mode-tools-1.73.1/laptop-mode-tools.spec
--- old/laptop-mode-tools-1.72.2/laptop-mode-tools.spec 2018-02-03
17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/laptop-mode-tools.spec 2020-01-11
12:47:05.000000000 +0100
@@ -3,7 +3,7 @@
Summary: Tools for power savings based on battery/AC status
Name: laptop-mode-tools
-Version: 1.72.2
+Version: 1.73.1
Release: 1
License: GPL
Group: System Environment/Base
@@ -83,7 +83,7 @@
#%{_usr}/sbin/*
%{_sbindir}/*
%{_usr}/share/applications/laptop-mode-tools.desktop
-%{_usr}/share/laptop-mode-tools/LMT.py
+%{_usr}/share/laptop-mode-tools/lmt.py
%{_usr}/share/laptop-mode-tools/modules/*
%{_usr}/share/laptop-mode-tools/module-helpers/*
%{_usr}/share/pixmaps/laptop-mode-tools.svg
@@ -106,6 +106,12 @@
%changelog
+* Sat Jan 11 2020 Ritesh Raj Sarraf <[email protected]> - 1.73.1-1
+- Updated to release 1.73.1
+
+* Sat Jan 11 2020 Ritesh Raj Sarraf <[email protected]> - 1.73-1
+- Updated to release 1.73
+
* Sat Feb 3 2018 Ritesh Raj Sarraf <[email protected]> - 1.72.2-1
- Updated to release 1.72.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/laptop-mode-tools-1.72.2/usr/sbin/laptop_mode
new/laptop-mode-tools-1.73.1/usr/sbin/laptop_mode
--- old/laptop-mode-tools-1.72.2/usr/sbin/laptop_mode 2018-02-03
17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/usr/sbin/laptop_mode 2020-01-11
12:47:05.000000000 +0100
@@ -35,7 +35,7 @@
# The laptop mode tools version number. Extracted by the installer makefile
# as well, so don't change the format!
-LMTVERSION=1.72
+LMTVERSION=1.73
# This script is loaded from multiple scripts to set the config defaults
# and to read the configuration on top of those. Only when the command is
@@ -133,23 +133,6 @@
# Initialize the PATH Variable
export PATH="${PATH}":/bin:/sbin:/usr/bin:/usr/sbin
-# This is a 2 phase locking approach. LMT_REQ_LOCK is the outer lock and
LMT_INVOC_LOCK is the inner lock
-# We take this approach to ensure the scenario that, "At any point when an
event occurs (AC/BATT), the
-# kernel can generate multiple events spanning over a couple of events. The
first event is honored and
-# lmt executes. If the last event triggered at the 9th second, there is a fair
chance that a good amount
-# of state change would have occured in the OS, to honor that state, we keep
an outer lock (LMT_REQ_LOCK)
-# handy, so that those changes can also be applied and not forgotten.
-# Workflow:
-# Event-1 is generated and lmt executes (lmt runtime could span 5-10 seconds)
-# At seventh second, 4 events generate. But Event-1 is still running.
-# We don't want to discard all the remaining 4 events, but at least honor 1 so
that we can act to the changes
-# that occured in the last 7 seconds.
-# So, Event-2 acquire LMT_REQ_LOCK and waits to acquire LMT_INVOC_LOCK (which
is acquire by Event-1)
-LMT_REQ_LOCK="/var/lock/lmt-req.lock"
-LMT_INVOC_LOCK="/var/lock/lmt-invoc.lock"
-LMT_BATTPOLL_LOCK="/var/lock/lmt-battpoll.lock"
-FLOCK=`which flock`
-
checkint ()
{
# $1 arg should be the string/integer
@@ -160,8 +143,22 @@
# Returns 1 if it is an integer
}
+
+checkCmd ()
+{
+ cmd=`which $1`;
+ if [ $? -eq 1 ]; then
+ return 1
+ fi
+ test -x $cmd || return 1;
+}
+
# Function to handle logging
-LOGGER=`which logger`;
+if checkCmd "logger"; then
+ LOGGER=`which logger`;
+else
+ echo "No logger command available" >&2;
+fi
log ()
{
@@ -215,6 +212,40 @@
fi
}
+echo_to_file_do() {
+ echo "$1" > "$2";
+}
+
+echo_to_file() {
+ echo_to_file_do "$1" "$2" 2>&1 | \
+ while read REPLY; do
+ log "VERBOSE" "$REPLY"
+ done
+ echo_to_file_retval=$?;
+}
+
+# This is a 2 phase locking approach. LMT_REQ_LOCK is the outer lock and
LMT_INVOC_LOCK is the inner lock
+# We take this approach to ensure the scenario that, "At any point when an
event occurs (AC/BATT), the
+# kernel can generate multiple events spanning over a couple of events. The
first event is honored and
+# lmt executes. If the last event triggered at the 9th second, there is a fair
chance that a good amount
+# of state change would have occured in the OS, to honor that state, we keep
an outer lock (LMT_REQ_LOCK)
+# handy, so that those changes can also be applied and not forgotten.
+# Workflow:
+# Event-1 is generated and lmt executes (lmt runtime could span 5-10 seconds)
+# At seventh second, 4 events generate. But Event-1 is still running.
+# We don't want to discard all the remaining 4 events, but at least honor 1 so
that we can act to the changes
+# that occured in the last 7 seconds.
+# So, Event-2 acquire LMT_REQ_LOCK and waits to acquire LMT_INVOC_LOCK (which
is acquire by Event-1)
+LMT_REQ_LOCK="/var/lock/lmt-req.lock"
+LMT_INVOC_LOCK="/var/lock/lmt-invoc.lock"
+LMT_BATTPOLL_LOCK="/var/lock/lmt-battpoll.lock"
+if checkCmd "flock"; then
+ FLOCK=`which flock`;
+else
+ log "ERR" "Core dependency flock unavailable. Aborting"
+ exit 1
+fi
+
# No default on these ones -- we need to detect if they have been set, for
# backward compatibility with MINIMUM_BATTERY_MINUTES etc.
AUTO_HIBERNATION_BATTERY_CHARGE_PERCENT=
@@ -534,6 +565,8 @@
INIT=0 # Display info in init script format?
FORCE=0 # Force reapplying the current state?
INITSCRIPT_STOP=0 # Track stop command from init script. Consumer
is lm-polling daemon
+ POWER_SYSFS="/proc/acpi/ac_adapter/*/state /proc/acpi/battery/*/state
/sys/class/power_supply/*/online /sys/class/power_supply/*/state
/sys/class/power_supply/*/status"
+ BATT_DETAILS="/sys/class/power_supply/*/capacity*
/sys/class/power_supply/*/energy* /sys/class/power_supply/*/manufacturer
/sys/class/power_supply/*/model /sys/class/power_supply/*/technology
/sys/class/power_supply/*/type"
# Evaluate options passed to laptop_mode in here
if [ "$1" = "status" ] ; then
@@ -544,7 +577,11 @@
log "STATUS" "Drive power status:"
for disk in $HD; do
if [ -r $disk ]; then
- hdparm -C $disk 2>/dev/null | sed "s/^/ /"
+ if checkCmd "hdparm"; then
+ hdparm -C $disk 2>/dev/null | sed "s/^/ /"
+ else
+ log "ERR" "hdparm command not available"
+ fi
else
log "STATUS" " Cannot read $disk, permission
denied - $0 needs to be run as root"
fi
@@ -562,7 +599,11 @@
esac
if [ -b $DEV ] ; then
if [ -r $DEV ] ; then
- log "STATUS" " $DEV: $((`blockdev
--getra $DEV` / 2)) kB"
+ if checkCmd "blockdev"; then
+ log "STATUS" " $DEV: $((`blockdev
--getra $DEV` / 2)) kB"
+ else
+ log "ERR" "blockdev command not
available"
+ fi
else
log "STATUS" " Cannot read $DEV,
permission denied - $0 needs to be run as root"
fi
@@ -577,7 +618,7 @@
fi
log "STATUS" " "
- STATFILES="/proc/sys/vm/laptop_mode /proc/apm /proc/pmu/info
/proc/sys/vm/bdflush /proc/sys/vm/dirty_ratio /proc/sys/fs/xfs/age_buffer
/proc/sys/fs/xfs/sync_interval /proc/sys/fs/xfs/lm_age_buffer
/proc/sys/fs/xfs/lm_sync_interval /proc/sys/vm/pagebuf/lm_flush_age
/proc/sys/fs/xfs/xfsbufd_centisecs /proc/sys/fs/xfs/xfssyncd_centisecs
/proc/sys/vm/dirty_background_ratio /proc/sys/vm/dirty_expire_centisecs
/proc/sys/fs/xfs/age_buffer/centisecs /proc/sys/vm/dirty_writeback_centisecs
/sys/devices/system/cpu/*/cpufreq/cpuinfo_*_freq
/sys/devices/system/cpu/*/cpufreq/scaling_governor
/proc/acpi/button/lid/*/state /proc/acpi/ac_adapter/*/state
/proc/acpi/battery/*/state /sys/class/power_supply/*/online
/sys/class/power_supply/*/state"
+ STATFILES="/proc/sys/vm/laptop_mode /proc/apm /proc/pmu/info
/proc/sys/vm/bdflush /proc/sys/vm/dirty_ratio /proc/sys/fs/xfs/age_buffer
/proc/sys/fs/xfs/sync_interval /proc/sys/fs/xfs/lm_age_buffer
/proc/sys/fs/xfs/lm_sync_interval /proc/sys/vm/pagebuf/lm_flush_age
/proc/sys/fs/xfs/xfsbufd_centisecs /proc/sys/fs/xfs/xfssyncd_centisecs
/proc/sys/vm/dirty_background_ratio /proc/sys/vm/dirty_expire_centisecs
/proc/sys/fs/xfs/age_buffer/centisecs /proc/sys/vm/dirty_writeback_centisecs
/sys/devices/system/cpu/*/cpufreq/cpuinfo_*_freq
/sys/devices/system/cpu/*/cpufreq/scaling_governor
/proc/acpi/button/lid/*/state
/sys/class/scsi_host/*/link_power_management_policy $POWER_SYSFS"
for THISFILE in $STATFILES ; do
if [ -e "$THISFILE" ] ; then
@@ -590,10 +631,59 @@
log "STATUS" " "
fi
done
+
+ # Post status, gracefully exit here
+ exit 0;
+
+ elif [ "$1" = "power-stats" ] ; then
+ if checkCmd "udevadm"; then
+ for SUPPLY_TYPE in /sys/class/power_supply/* ; do
+ log "STATUS" "Power Supply details for $SUPPLY_TYPE"
+ log "STATUS" ""
+ udevadm info -q all $SUPPLY_TYPE;
+ done
+ else
+ log "VERBOSE" "No udevadm available. Using hardcoded paths";
+ for THISFILE in $POWER_SYSFS $BATT_DETAILS; do
+ if [ -e "$THISFILE" ] ; then
+ log "STATUS" "$THISFILE:"
+ if [ -r "$THISFILE" ] ; then
+ cat "$THISFILE" | sed "s/^/ /"
+ else
+ log "STATUS" " Not accessible,
permission denied - $0 needs to be run as root."
+ fi
+ log "STATUS" " "
+ fi
+ done
+ fi
# Post status, gracefully exit here
exit 0;
+ elif [ "$1" = "power-events" ] ; then
+ if checkCmd "udevadm"; then
+ log "STATUS" "Running Laptop Mode Tools in event tracing
mode. Press ^C to interrupt"
+ udevadm monitor --udev --property --kernel
--subsystem-match=power_supply --subsystem-match=usb
+ else
+ log "ERR" "No udevadm available to run trace"
+ exit 1;
+ fi
+
+ # Post status, gracefully exit here
+ exit 0;
+ elif [ "$1" = "help" -o "$1" = "--help" -o "$1" = "-h" ]; then
+ log "MSG" "****************************"
+ log "MSG" "Following user commands are understood"
+ log "MSG" "status : Display a Laptop Mode Tools power
savings status"
+ log "MSG" "power-stats : Display the power statistics on the
machine"
+ log "MSG" "power-events : Trap power related events on the
machine"
+ log "MSG" "help : Display this help message (--help, -h)"
+ log "MSG" "version : Display program version (--version, -v)"
+ log "MSG" "****************************"
+ exit 0;
+ elif [ "$1" = "version" -o "$1" = "--version" -o "$1" = "-v" ]; then
+ log "MSG" "Laptop Mode Tools $LMTVERSION"
+ exit 0;
elif [ "$1" != "readconfig" -a "$1" != "defaults" ] ; then
#############################################################################
@@ -615,22 +705,6 @@
# Stop exporting everything -- what we do from here is private.
set +a
- if [ "$1" = "--version" ] ; then
- log "MSG" "Laptop Mode Tools $LMTVERSION"
- exit 0
- fi
-
- if [ ! -e /proc/sys/vm/laptop_mode ] ; then
- log "ERR" "Kernel does not have support for laptop
mode. Please apply the laptop mode"
- log "ERR" "patch or install a newer kernel."
- exit 1
- fi
-
- if [ ! -w /proc/sys/vm/laptop_mode ] ; then
- log "ERR" "You do not have enough privileges to enable
laptop_mode."
- exit 1
- fi
-
while [ "$1" != "" ] ; do
case "$1" in
init) INIT=1 ;;
@@ -653,6 +727,17 @@
esac
shift
done
+
+ if [ ! -e /proc/sys/vm/laptop_mode ] ; then
+ log "ERR" "Kernel does not have support for laptop
mode. Please apply the laptop mode"
+ log "ERR" "patch or install a newer kernel."
+ exit 1
+ fi
+
+ if [ ! -w /proc/sys/vm/laptop_mode ] ; then
+ log "ERR" "You do not have enough privileges to enable
laptop_mode."
+ exit 1
+ fi
fi
}
@@ -671,7 +756,7 @@
PREV_ENOUGH_CHARGE_TO_PREVENT_HIBERNATION=$ENOUGH_CHARGE_TO_PREVENT_HIBERNATION
log "VERBOSE" "Checking levels for $BATT."
- PRESENT=$(cat $BATT/present)
+ PRESENT=$(cat $BATT/present 2> /dev/null ||
echo "0")
log "VERBOSE" "Present: $PRESENT."
# Only do if the battery is present
@@ -993,8 +1078,8 @@
log "VERBOSE" 'Setting action to "start"
because the lid is closed (says /proc/acpi/button/lid/*/state).'
ACTIVATE=1
fi
- elif ( which hal-find-by-property >/dev/null ) ; then
- HAL_LID_BUTTON=$($HAL_FIND_BY_PROPERTY --key
"button.type" --string "lid")
+ elif checkCmd "hal-find-by-property" ; then
+ HAL_LID_BUTTON=$(hal-find-by-property --key
"button.type" --string "lid")
if [ "$HAL_LID_BUTTON" != "" ] ; then
HAL_LID_BUTTON_STATE=$(hal-get-property --udi
$(hal-find-by-property --key "button.type" --string "lid") --key
"button.state.value")
if [ "$HAL_LID_BUTTON_STATE" = "true" ] ; then
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon
---
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon
2018-02-03 17:08:43.000000000 +0100
+++
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon
2020-01-11 12:47:05.000000000 +0100
@@ -10,6 +10,11 @@
# risks data loss).
INTERVAL=150
+if [ -d /run/systemd/system ]; then
+ echo "systemd detected. Battery polling is supported through lmt-poll
timer";
+ return 0;
+fi
+
while :; do
sleep $INTERVAL
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/cpufreq
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/cpufreq
--- old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/cpufreq
2018-02-03 17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/cpufreq
2020-01-11 12:47:05.000000000 +0100
@@ -24,6 +24,34 @@
cat "$1" | tr ' ' '\n' | sort -n | awk -v RS="" '{n=split($0,a); print
a[int((n+1)/2)]}'
}
+# get_real_cpu_governor trys to correct the special governor "auto":
+#
+# 1. use ondemand on CPUs that are not using intel_pstate driver.
+# 2. on CPUs that are using intel_psatte driver:
+# - use powersave if the machine is on battery
+# - otherwise use performance.
+#
+# $1 = the CPU to be set governor on.
+# $2 = the governor to use.
+get_real_cpu_governor() {
+ local CPU=$1
+ local GOVERNOR=$2
+ if [ x$GOVERNOR = xauto ]; then
+ if [ -f "$CPU/cpufreq/scaling_driver" ] &&
+ [ "$(cat $CPU/cpufreq/scaling_driver)" = "intel_pstate" ]
+ then
+ if [ $ON_AC -eq 1 ] ; then
+ GOVERNOR=performance
+ else
+ GOVERNOR=powersave
+ fi
+ else
+ GOVERNOR=ondemand
+ fi
+ fi
+ echo $GOVERNOR
+}
+
if [ x$CONTROL_CPU_FREQUENCY = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a
x$CONTROL_CPU_FREQUENCY = xauto ]; then
if [ $ON_AC -eq 1 ] ; then
@@ -45,11 +73,7 @@
CPU_IGNORE_NICE_LOAD="$BATT_CPU_IGNORE_NICE_LOAD"
fi
for THISCPU in /sys/devices/system/cpu/* ; do
- if [ -f "$THISCPU/cpufreq/scaling_driver" ] &&
- [ "$(cat $THISCPU/cpufreq/scaling_driver)" = "intel_pstate" ]
- then
- continue # intel_pstate is a bit different - so it
should be handled by its own module
- fi
+ CPU_GOVERNOR="$(get_real_cpu_governor $THISCPU $CPU_GOVERNOR)"
if [ -e $THISCPU/cpufreq/cpuinfo_min_freq ]; then
THIS_CPU_MAXFREQ="$CPU_MAXFREQ"
THIS_CPU_MINFREQ="$CPU_MINFREQ"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/hal-polling
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/hal-polling
---
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/hal-polling
2018-02-03 17:08:43.000000000 +0100
+++
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/hal-polling
2020-01-11 12:47:05.000000000 +0100
@@ -34,7 +34,8 @@
for DEV in $HAL_POLLING_DEVICES ; do
# Thanks to the kernel's new in-kernel block dev polling.
- device=`readlink $DEV`;
+ device=`realpath $DEV | awk -v FS="/" '{print $NF}'`;
+
if [ -f /sys/block/$device/events_poll_msecs ]; then
if [ x$DISABLE_HAL_POLLING = x1 ]; then
echo 0 > /sys/block/$device/events_poll_msecs;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/runtime-pm
new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/runtime-pm
--- old/laptop-mode-tools-1.72.2/usr/share/laptop-mode-tools/modules/runtime-pm
2018-02-03 17:08:43.000000000 +0100
+++ new/laptop-mode-tools-1.73.1/usr/share/laptop-mode-tools/modules/runtime-pm
2020-01-11 12:47:05.000000000 +0100
@@ -8,31 +8,17 @@
device=$1
list=$2
- if ! idvendor=$(cat $device/idVendor 2>/dev/null || cat $device/vendor
2>/dev/null) || \
- ! idproduct=$(cat $device/idProduct 2>/dev/null || cat
$device/device 2>/dev/null); then
+ if ! { read -r idvendor < $device/idVendor || read -r idvendor <
$device/vendor; } 2>/dev/null || \
+ ! { read -r idproduct < $device/idProduct || read -r idproduct <
$device/device; } 2>/dev/null; then
return 1
fi
idvendor=${idvendor#0x}
idproduct=${idproduct#0x}
for devid in $list; do
- case $devid in
- *:*) ;;
- *) continue;;
- esac
-
- vendor=${devid%:*}
- product=${devid#*:}
-
- case $idvendor in
- ${vendor})
- case $idproduct in
- ${product}) return 0;;
- *) ;;
- esac
- ;;
- *);;
- esac
+ if [ "$devid" = "$idvendor:$idproduct" ]; then
+ return 0
+ fi
done
return 1
}
@@ -40,19 +26,19 @@
# Check whether the driver type is blacklisted
listed_by_type() {
device=$1
- device_base=`basename $device`
+ device_base=${device##*/}
list=$2
- if ! uevent_data=$(cat $device/uevent 2>/dev/null); then
- return 1
- fi
+ [ -r $device/uevent ] || return 1
- for driver_type in $list; do
- case "$uevent_data" in
- *DRIVER=$driver_type*) return 0 ;;
- *DEVTYPE=$driver_type*) return 0 ;;
- esac
- done
+ while read -r uevent_data; do
+ for driver_type in $list; do
+ case "$uevent_data" in
+ DRIVER=$driver_type) return 0 ;;
+ DEVTYPE=$driver_type) return 0 ;;
+ esac
+ done
+ done < $device/uevent
# Check child devices as well. The actual driver type is
# listed in a child device, not the top-level device.
@@ -82,15 +68,18 @@
return 0
}
-echo_to_file_do() {
- echo "$1" > "$2"
-}
-echo_to_file() {
- echo_to_file_do "$1" "$2" 2>&1 | \
- while read REPLY; do
- log "VERBOSE" "$REPLY"
- done
-}
+if $LM_VERBOSE; then
+ echo_to_file() {
+ echo "$1" 2>&1 >"$2" |
+ while read REPLY; do
+ log "VERBOSE" "$REPLY"
+ done
+ }
+else
+ echo_to_file() {
+ echo "$1" > "$2" 2>/dev/null
+ }
+fi
if [ x$CONTROL_RUNTIME_AUTOSUSPEND = x1 ] || [ x$ENABLE_AUTO_MODULES = x1 -a
x$CONTROL_RUNTIME_AUTOSUSPEND = xauto ]; then
if [ $ON_AC -eq 1 ]; then
@@ -164,6 +153,23 @@
if [ "$DEVICE_LIST" != "" ]; then
for runtime_device in $DEVICE_LIST;
do
+
+ USE_DEVICE=0
+ if [ x$AUTOSUSPEND_USE_WHITELIST = x1 ]; then
+ if whitelisted $runtime_device; then
+ USE_DEVICE=1
+ else
+ log "VERBOSE" "Device
$runtime_device not whitelisted, skipping auto suspend."
+ fi
+ else
+ if ! blacklisted $runtime_device; then
+ USE_DEVICE=1
+ else
+ log "Device $runtime_device is
blacklisted, skipping auto suspend."
+ fi
+ fi
+ [ x$USE_DEVICE = x1 ] || continue
+
if [ -f
"$runtime_device"/power/autosuspend_delay_ms ]; then
echo_to_file $AUTOSUSPEND_TIMEOUT
"$runtime_device"/power/autosuspend_delay_ms
log "VERBOSE" "Disabling auto suspend
mode for device $runtime_device."