summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-06-09 17:00:56 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-06-13 20:00:23 +0200
commitb4564641bec7e4d6b2070f6052fee8f35ece6a78 (patch)
tree605c4121cc206f8d3d2af2b997582c67d3322d1a
parenttest-network: wait 2min for the bridge being in configured state (diff)
downloadsystemd-b4564641bec7e4d6b2070f6052fee8f35ece6a78.tar.xz
systemd-b4564641bec7e4d6b2070f6052fee8f35ece6a78.zip
hwdb: generate a hwdb file instead of rules for autosuspend
-rw-r--r--hwdb.d/meson.build8
-rw-r--r--rules.d/meson.build8
-rwxr-xr-xtools/make-autosuspend-rules.py21
3 files changed, 28 insertions, 9 deletions
diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build
index 4df6dabf89..e5ac23a8ff 100644
--- a/hwdb.d/meson.build
+++ b/hwdb.d/meson.build
@@ -52,3 +52,11 @@ run_target(
run_target(
'autosuspend-update',
command : [autosuspend_update_sh, project_source_root + '/tools/chromiumos'])
+
+auto_suspend_rules = custom_target(
+ '60-autosuspend-chromiumos.hwdb',
+ output : '60-autosuspend-chromiumos.hwdb',
+ command : make_autosuspend_rules_py,
+ capture : true,
+ install : true,
+ install_dir: udevhwdbdir)
diff --git a/rules.d/meson.build b/rules.d/meson.build
index 13d1d330cf..b4684486c2 100644
--- a/rules.d/meson.build
+++ b/rules.d/meson.build
@@ -45,11 +45,3 @@ foreach file : rules_in
install_dir : udevrulesdir)
all_rules += gen
endforeach
-
-auto_suspend_rules = custom_target(
- '60-autosuspend-chromiumos.rules',
- output : '60-autosuspend-chromiumos.rules',
- command : make_autosuspend_rules_py,
- capture : true,
- install : true,
- install_dir: [udevrulesdir])
diff --git a/tools/make-autosuspend-rules.py b/tools/make-autosuspend-rules.py
index 25b261ea0d..3faf5f4d71 100755
--- a/tools/make-autosuspend-rules.py
+++ b/tools/make-autosuspend-rules.py
@@ -8,7 +8,26 @@
import sys
import chromiumos.gen_autosuspend_rules
+HWDB_FILE = """\
+%(usb_entries)s\
+%(pci_entries)s\
+"""
+
if __name__ == '__main__':
if len(sys.argv) > 1:
sys.stdout = open(sys.argv[1], 'w')
- chromiumos.gen_autosuspend_rules.main()
+
+ pci_entries = ''
+ for dev_ids in chromiumos.gen_autosuspend_rules.PCI_IDS:
+ vendor, device = dev_ids.split(':')
+
+ pci_entries += ('usb:v%sp%s*\n'
+ ' ID_AUTOSUSPEND=1\n' % (vendor, device))
+ usb_entries = ''
+ for dev_ids in chromiumos.gen_autosuspend_rules.USB_IDS:
+ vendor, device = dev_ids.split(':')
+
+ usb_entries += ('pci:v%sp%s*\n'
+ ' ID_AUTOSUSPEND=1\n' % (vendor, device))
+
+ print(HWDB_FILE % {'pci_entries' : pci_entries, 'usb_entries': usb_entries})