summaryrefslogtreecommitdiff
path: root/tools/make-autosuspend-rules.py
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@dell.com>2019-09-09 22:49:35 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-04 08:57:29 +0200
commitb61d777abeecd8b6c76035e11899aae210633534 (patch)
treefceadec42baa379b4c6c92789361d713aa2e4584 /tools/make-autosuspend-rules.py
parent3a77f9fb4c2ff8d26ef772c7426fcbc37ad4d023 (diff)
downloadsystemd-b61d777abeecd8b6c76035e11899aae210633534.tar.gz
rules: Add automatic suspend udev rules
The ChromeOS ecosystem has a large amount of testing, both automated and manual across devices including measurement of power regressions. It's safe to assume that any of these devices will handle USB auto-suspend appropriately. Use the script from ChromeOS https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py to generate udev rules at build time. This script in systemd `tools/chromeos/gen_autosuspend_rules.py` should be kept in sync with the ChromeOS version of the script. Manually added autosuspend devices should be placed in the new template `rules/61-autosuspend-manual.rules` Suggested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Diffstat (limited to 'tools/make-autosuspend-rules.py')
-rwxr-xr-xtools/make-autosuspend-rules.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/make-autosuspend-rules.py b/tools/make-autosuspend-rules.py
new file mode 100755
index 0000000000..732731626d
--- /dev/null
+++ b/tools/make-autosuspend-rules.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-2.1+
+
+# Generate autosuspend rules for devices that have been whitelisted (IE tested)
+# by the ChromeOS team. Please keep this script in sync with:
+# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
+
+import sys
+import chromeos.gen_autosuspend_rules
+
+if __name__ == '__main__':
+ if len(sys.argv) > 1:
+ sys.stdout = open(sys.argv[1], 'w')
+ chromeos.gen_autosuspend_rules.main()