summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-22 17:38:42 +0200
committerGitHub <noreply@github.com>2020-06-22 17:38:42 +0200
commitc2c193f79a1be094f42d548ace0390472075b963 (patch)
tree00c5069810096bd15034e6fb7384c9c5509b78b1 /tools
parent5fde0607a866107362cdb5590de36ade1d341ae8 (diff)
parent7b33ff7388a4d1de9376ef2883a73272107d44a9 (diff)
downloadsystemd-c2c193f79a1be094f42d548ace0390472075b963.tar.gz
Merge pull request #16179 from keszybz/auto-suspend-hwdb
Convert autosuspend rules to hwdb
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-autosuspend-rules.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/make-autosuspend-rules.py b/tools/make-autosuspend-rules.py
index 25b261ea0d..065752ced4 100755
--- a/tools/make-autosuspend-rules.py
+++ b/tools/make-autosuspend-rules.py
@@ -1,14 +1,24 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
-# Generate autosuspend rules for devices that have been whitelisted (IE tested)
-# by the Chromium OS team. Please keep this script in sync with:
+# Generate autosuspend rules for devices that have been tested to work properly
+# with autosuspend by the Chromium OS team. Based on
# https://chromium.googlesource.com/chromiumos/platform2/+/master/power_manager/udev/gen_autosuspend_rules.py
-import sys
import chromiumos.gen_autosuspend_rules
-if __name__ == '__main__':
- if len(sys.argv) > 1:
- sys.stdout = open(sys.argv[1], 'w')
- chromiumos.gen_autosuspend_rules.main()
+print('# pci:v<00VENDOR>d<00DEVICE> (8 uppercase hexadecimal digits twice)')
+for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
+ vendor, device = entry.split(':')
+ vendor = int(vendor, 16)
+ device = int(device, 16)
+ print(f'pci:v{vendor:08X}d{device:08X}*')
+
+print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice')
+for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
+ vendor, product = entry.split(':')
+ vendor = int(vendor, 16)
+ product = int(product, 16)
+ print(f'usb:v{vendor:04X}p{product:04X}*')
+
+print(' ID_AUTOSUSPEND=1')